Electron app with simple scripting problem

I am trying to modify the code in the sample electron app.

I get an error and I don’t know what it means. Up to the very end everything works well and I am comforted by the message:

    npm timing npm Completed in 2922ms
    npm info ok

I get down to the end, and then I get this:

    Running: cp -a dist/linux*unpacked /app/main
    F: Unexpected filesystem suffix reset, ignoring
    Running: install -Dm755 -t /app/bin/ ../run.sh
    F: Unexpected filesystem suffix reset, ignoring
    install: omitting directory '../run.sh'
    Error: module TheGuy: Child process exited with code 1

Here I will include my complete yaml file.


app-id: org.theguy.TheGuy
runtime: org.freedesktop.Platform
runtime-version: '20.08'
sdk: org.freedesktop.Sdk
base: org.electronjs.Electron2.BaseApp
base-version: '20.08'
sdk-extensions:
  - org.freedesktop.Sdk.Extension.node14
command: run.sh
separate-locales: false
finish-args:
  - --share=ipc
  - --socket=x11
  - --socket=pulseaudio
  - --share=network
build-options:
  append-path: /usr/lib/sdk/node14/bin
  cflags: -O2 -g
  cxxflags: -O2 -g
  env:
    NPM_CONFIG_LOGLEVEL: info
modules:
  - name: TheGuy
    buildsystem: simple
    build-options:
      env:
        # electron_config_cache: /run/build/TheGuy/npm-cache
        XDG_CACHE_HOME: /run/build/TheGuy/flatpak-node/cache
        npm_config_cache: /run/build/TheGuy/flatpak-node/npm-cache
        npm_config_nodedir: /usr/lib/sdk/node14
        npm_config_offline: 'true'
    subdir: main
    sources:
      - type: dir
        path: ..
        dest: main
      - generated-sources.json
      # Wrapper to launch the app
      - type: script
        dest: run.sh
        commands:
          - zypak-wrapper.sh /app/main/TheGuy "$@"
    build-commands:
      # Install npm dependencies
      - npm install --offline
      # Build the app; in this example the `dist` script
      # in package.json runs electron-builder
      - |
        . ../flatpak-node/electron-builder-arch-args.sh
        npm run dist -- $ELECTRON_BUILDER_ARCH_ARGS   --linux --dir
      # Bundle app and dependencies
      - cp -a dist/linux*unpacked /app/main
      # Install app wrapper
      - install -Dm755 -t /app/bin/ ../run.sh

As you can see, my problem is with the very last of the build commands.

EDIT: One other thing. I needed to build flatpak-builder from source because it was not recognizing my ‘generated-sources.json’ file. I did not specify any special build flags in the ‘./configure’ stage. Might this mess me up? I could not find any online tutorial about building flatpak-builder from scratch.

I checked out flatpak-builder 1.2.1 and built that. Doing so got rid of the message about ‘F: Unexpected filesystem suffix reset, ignoring’. Still, though, the ‘run.sh’ file is somehow turned into a directory. I get some text at the end that says:

    Running: install -Dm755 -t /app/bin/ ../run.sh
    install: omitting directory '../run.sh'
    Error: module TheGuy: Child process exited with code 1

I seem to have gotten it to work. I had a typo in the section that creates the run.sh file. Mine read ‘dest: run.sh’ and it should be ‘dest-filename: run.sh’.

The other thing is that in some places the name of the app needs to be in lowercase. I ended up using Camel Case for the ‘app-id’ and using kebab-case for everything else.