Convert .deb to Flatpak?

@refi64 Haha! yes. Proceeding in stits and farts, as my dear old Dad used to say.
Finally got kde platform and sdk installed. Ended up with version 5.13 though. Flatpak couldn’t find 5.16, or 5.15, or 5.14.
Tried to run it again, this time it couldn’t find libSDL-1.2.so.0.

Ack I indeed screwed up the versions, the latest KDE runtimes are 5.12 stable and 5.13 beta (?).

SDL is available in the shared-modules repo.

@refi64 it works!!! Here it is in all its glory.


I don’t really understand the “git add submodule” thing that is recommended in the shared-modules repo. I’m guessing it’s for real developers who are working on a project and can add the shared-modules as a submodule for their project. I’m not doing that, I’m trying to use somebody else’s project. I did a bit of reading and it seems what I would have to do is create a git repository on my computer, then add shared-modules to that as a submodule, then it might all work. All I did was copy all the files (.json and two patch files) to the directory my .json is in and everything worked.

Thanks so much for all your help, I would never have got there without it.
:smile: Ian

2 Likes

Okay I might have gone off half cocked. What “works” means, in this case, is that the app starts. From then on it gets a bit confusing.
The first time I ran it with flatpak-builder it seemed to be working. I could read model data from the radio, and save them to my PC. Turns out it didn’t actually save anything but I didn’t realise that at the time. Problem 2 was that the script in the middle of the manifest didn’t work. I eventually worked out that the file name it was trying to extract was wrong, it was “data.tar.xz”, the correct file name was “data.tar.gz”. Then the tar command didn’t work as it had the wrong options. Finally sorted all that out, and the script ran. Before that I had no way of starting the app other than with the flatpak-builder command as the .desktop file was not set up. Now it is, so that’s all good.
Couple of problems left now.

  1. When the app starts a dialog is displayed saying “can’t check for updates”. Presumabely it can’t access the net.
  2. I can’t communicate with the radio any more. Attempting to shows a dialog saying “no radio connected”. It seems it can’t access USB devices either. No idea why that should be, especially as it did work the first time I got the flatpak built.

One last thing, I have been unable to find anywhere that explains what “install -D …” means, and what “install -Dm644 …” means. It appears to me that all “install” does is copy the file (pointed to by the -D parameter?) to the location specified as the second parameter. The “644” looks a bit like a permission value, but that’s a wild guess on my part. Is this documented anywhere.

Here’s the latest manifest.

  "app-id": "org.opentx.companion22",
  "runtime": "org.kde.Platform",
  "runtime-version": "5.13",
  "sdk": "org.kde.Sdk",
  "command": "companion22",
  "tags": [
    "opensource"
  ],
  "finish-args": [
    "--filesystem=home",
    "--socket=x11",
    "--device=all",
    "--share=ipc"
  ],
  "cleanup": [
    "/include",
    "/lib/pkgconfig",
    "/share/pkgconfig"
  ],
  "modules": [
	{
	    "name": "SDL1",
	    "rm-configure": true,
	    "config-opts": ["--disable-static"],
	    "cleanup": [
	        "/bin",
	        "/share/man",
	        "/share/aclocal",
	        "/include",
	        "/lib/pkgconfig",
	        "/lib/*.la",
	        "/lib/*.a"
	    ],
	    "sources": [
	        {
	            "type": "archive",
	            "url": "https://www.libsdl.org/release/SDL-1.2.15.tar.gz",
	            "sha256": "d6d316a793e5e348155f0dd93b979798933fb98aa1edebcc108829d6474aad00"
	        },
	        {
	            "type": "patch",
	            "path": "sdl-libx11-build.patch"
	        },
	        {
	            "type": "patch",
	            "path": "sdl-check-for-SDL_VIDEO_X11_BACKINGSTORE.patch"
	        },
	        {
	            "type": "script",
	            "dest-filename": "autogen.sh",
	            "commands": [
	                "sed -i -e 's/.*AM_PATH_ESD.*//' configure.in",
	                "cp -p /usr/share/automake-*/config.{sub,guess} build-scripts",
	                "aclocal",
	                "libtoolize",
	                "autoconf"
	            ]
	        }
	    ]
	},
    {
      "name": "glu",
      "config-opts": ["--disable-static"],
      "sources": [
        {
          "type": "archive",
          "url": "https://mesa.freedesktop.org/archive/glu/glu-9.0.0.tar.bz2",
          "sha256": "1f7ad0d379a722fcbd303aa5650c6d7d5544fde83196b42a73d1193568a4df12"
        }
      ],
      "cleanup": [ "/include", "/lib/*.a", "/lib/*.la", "/lib/pkgconfig" ]
    },    
    {
      "name": "companion22",
      "buildsystem": "simple",
      "build-commands": [
        "install -D apply_extra /app/bin/apply_extra",
        "install -D companion22 /app/bin/companion22",
        "install -Dm644 org.opentx.companion22.appdata.xml /app/share/appdata/org.opentx.companion22.appdata.xml",
        "install -D companion22.svg /app/share/icons/hicolor/scalable/apps/org.opentx.companion22.svg",
        "install -D companion22.png /app/share/icons/hicolor/16x16/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/22x22/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/24x24/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/32x32/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/48x48/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/128x128/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/256x256/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/512x512/org.opentx.companion22.png",
        "install -D /usr/bin/ar /app/bin/ar",
        "install -D /usr/bin/desktop-file-install /app/bin/desktop-file-install",
        "mkdir -p /app/lib",
        "ARCH_TRIPLE=$(gcc --print-multiarch) && cp /usr/lib/${ARCH_TRIPLE}/libbfd-*.so /app/lib"
      ],
      "sources": [
        {
          "type": "script",
          "dest-filename": "apply_extra",
          "commands": [
            "ar p companion22_2.2.4_amd64.deb data.tar.gz | tar xz",
            "rm -f companion22_2.2.4_amd64.deb",
            "mv usr/* .",
            "rmdir usr",
            "mv share/applications/companion22.desktop share/applications/org.opentx.companion22.desktop",
            "mv share/applications/simulator22.desktop share/applications/org.opentx.simulator.desktop",
            "desktop-file-install --dir=export/share/applications --set-key=Exec --set-value=/app/bin/companion22 --set-icon=org.opentx.companion22 share/applications/org.opentx.companion22.desktop"
          ]
        },
        {
          "type": "extra-data",
          "filename": "companion22_2.2.4_amd64.deb",
          "only-arches": [
            "x86_64"
          ],
          "url": "https://downloads.open-tx.org/2.2/release/companion/linux/companion22_2.2.4_amd64.deb",
          "sha256": "3cd9f2e9214e13cea5f6eb6183124344aa5d31c58dc79ca2f0448ad116eb6133",
          "size": 20247440
        },
        {
          "type": "file",
          "path": "org.opentx.companion22.appdata.xml"
        },
        {
          "type": "file",
          "path": "data/usr/local/bin/companion22"
        },
        {
          "type": "file",
          "path": "data/usr/share/icons/hicolor/scalable/apps/companion22.svg"
        },
        {
          "type": "file",
          "path": "data/usr/share/icons/hicolor/16x16/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "data/usr/share/icons/hicolor/22x22/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "data/usr/share/icons/hicolor/24x24/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "data/usr/share/icons/hicolor/32x32/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "data/usr/share/icons/hicolor/48x48/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "data/usr/share/icons/hicolor/128x128/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "data/usr/share/icons/hicolor/256x256/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "data/usr/share/icons/hicolor/512x512/apps/companion22.png"
        }
      ]
    }
  ]
}

Thanks, Ian

Ah, you’re probably missing some permissions. You can add --share=network to finish-args for network access (though any auto updater will probably fail to work because, well, this is a Flatpak). For the connection issues, it turns out OpenTX is open source, so I went through the source code to see what I could find. It seems that it connects to the devices via Bluetooth, so adding --allow=bluetooth to finish-args might fix that.

install is indeed basically cp on steroids, here’s the man page. The basic format is install SOURCE-FILE TARGET-FILE; passing -D tells it to create any parent directories of the target file, and -m XXX indeed tells it the permissions to set.

One last thing to note: you’re storing the same icon png in multiple icon size directories, which isn’t quite correct (since each side directory is designed for icons just of that size). Since you have a scalable SVG icon, you can just install that one and leave out all the PNGs.

Thanks @refi64, things are slowly starting to make sense.

Yes OpenTx is open source. I probably should have mentioned that at some point. But they are basically in bed with a brand of radio called FrSky, and focus almost exclusively on supporting FrSky transmitters. They support some others as well, but FrSky would account for 90% of the development effort. But that’s okay, that’s the brand of transmitter I have!

Not sure about the Bluetooth thing though. I know there are some upmarket (read expensive) transmitters that do have Bluetooth, but most don’t. Mine hasn’t. It’s usually used for training, where the instructor has a transmitter and the student uses a separate one. They can be connected by Bluetooth, but usually they are connected by a cable. The instructor can pass control to the student’s transmitter via a switch (usually momentary) on his transmitter that passes control of the plane to the student’s transmitter. So he can take back control of the plane if (when) the student gets into trouble quickly and easily, hopefully before the plane crashes.

On the programming side though the transmitter is connected to the PC via a standard USB cable, so not related to Bluetooth at all.

Re the png names, in the .deb file there is a load of directories called 16x16, 32x32, 48x48 etc, and they all have one icon file in them, and they all have the same name, companion22.png. So even though it looks like the same file every time, actually it isn’t. I’ll try leaving out all the .pngs though and see what happens.

In other news I’m attempting to convert the json file to a yaml file. I can’t cope with all the square brackets, curly brackets, commas et al, yaml seems to be a lot easier for my old brain to comprehend. Got most of it sorted, but not all, so expect some yaml questions in the near future!

Cheers, Ian

Hmm this is rather odd then, I’m not sure what other permissions the app would need… You can add permissions in flatpak run like flatpak run --device=all... for testing to see if some permission fixes it, so you don’t have to constantly rebuild the flatpak.

The trick here, though, is that 22x22 companion22.png overwrites the 16x16 one, the 32x32 overwrites the previous one, etc. You end up copying the 512x512 png into every image directory.

Indeed, it can be rather painful! If you want to see what the equivalent json for some yaml would be, this site is useful for quick tests.

Hi @refi64

I think I need to go and do something else for a while. This thing is driving me nuts.

I’ve got --device=all in the manifest already. I tried adding --share=network, but I still got the same “unable to check for rupdates” message.

I found a site that converts json to yaml. It seems I had most of it right, but now the “ar” command in the script to unpack the .deb flatly refuses to run. It works fine if I enter the command in a terminal, or put it in a bash script, but it won’t run from the json file. It won’t run from the yaml file either. Whenever I run it no directory called “usr” is created, which is what it’s supposed to do. If the “usr” directory is already there because I’ve just executed the command outside the json, then the json works and creates the app. The yaml file however, does not. It gives an error message “Error: Command ‘companion22’ not found”. I also get this warning '(flatpak-builder:9761): Json-WARNING **: 15:15:40.151: Failed to deserialize “modules” property of type “gpointer” for an object of type “BuilderManifest” ', but it’s only a warning so not sure if I need to worry about it or not?

With the json file I get a message ‘Failed to download sources: module companion22: Can’t find file at usr/local/bin/companion22’ if the “usr” directory is not there when I run it (i.e. I haven’t created it first). If it is already there, the build works.

So, a couple of giant leaps backwards today.

:frowning: Ian

PS this is the latest version.

  "app-id": "org.opentx.companion22",
  "runtime": "org.kde.Platform",
  "runtime-version": "5.13",
  "sdk": "org.kde.Sdk",
  "command": "companion22",
  "tags": [
    "opensource"
  ],
  "finish-args": [
    "--filesystem=home",
    "--socket=x11",
    "--device=all",
    "--share=ipc",
    "--share=network"
  ],
  "cleanup": [
    "/include",
    "/lib/pkgconfig",
    "/share/pkgconfig"
  ],
  "modules": [
	{
	    "name": "SDL1",
	    "rm-configure": true,
	    "config-opts": ["--disable-static"],
	    "cleanup": [
	        "/bin",
	        "/share/man",
	        "/share/aclocal",
	        "/include",
	        "/lib/pkgconfig",
	        "/lib/*.la",
	        "/lib/*.a"
	    ],
	    "sources": [
	        {
	            "type": "archive",
	            "url": "https://www.libsdl.org/release/SDL-1.2.15.tar.gz",
	            "sha256": "d6d316a793e5e348155f0dd93b979798933fb98aa1edebcc108829d6474aad00"
	        },
	        {
	            "type": "patch",
	            "path": "sdl-libx11-build.patch"
	        },
	        {
	            "type": "patch",
	            "path": "sdl-check-for-SDL_VIDEO_X11_BACKINGSTORE.patch"
	        },
	        {
	            "type": "script",
	            "dest-filename": "autogen.sh",
	            "commands": [
	                "sed -i -e 's/.*AM_PATH_ESD.*//' configure.in",
	                "cp -p /usr/share/automake-*/config.{sub,guess} build-scripts",
	                "aclocal",
	                "libtoolize",
	                "autoconf"
	            ]
	        }
	    ]
	},
    {
      "name": "glu",
      "config-opts": ["--disable-static"],
      "sources": [
        {
          "type": "archive",
          "url": "https://mesa.freedesktop.org/archive/glu/glu-9.0.0.tar.bz2",
          "sha256": "1f7ad0d379a722fcbd303aa5650c6d7d5544fde83196b42a73d1193568a4df12"
        }
      ],
      "cleanup": [ "/include", "/lib/*.a", "/lib/*.la", "/lib/pkgconfig" ]
    },    
    {
      "name": "companion22",
      "buildsystem": "simple",
      "build-commands": [
        "install -D apply_extra /app/bin/apply_extra",
        "install -D companion22 /app/bin/companion22",
        "install -D simulator22 /app/bin/simulator22",
        "install -Dm644 org.opentx.companion22.appdata.xml /app/share/appdata/org.opentx.companion22.appdata.xml",
        "install -D companion22.svg /app/share/icons/hicolor/scalable/apps/org.opentx.companion22.svg",
        "install -D companion22.png /app/share/icons/hicolor/16x16/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/22x22/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/24x24/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/32x32/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/48x48/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/128x128/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/256x256/org.opentx.companion22.png",
        "install -D companion22.png /app/share/icons/hicolor/512x512/org.opentx.companion22.png",
        "install -D /usr/bin/ar /app/bin/ar",
        "install -D /usr/bin/desktop-file-install /app/bin/desktop-file-install",
        "mkdir -p /app/lib",
        "ARCH_TRIPLE=$(gcc --print-multiarch) && cp /usr/lib/${ARCH_TRIPLE}/libbfd-*.so /app/lib"
      ],
      "sources": [
        {
          "type": "script",
          "dest-filename": "apply_extra",
          "commands": [
            "ar p companion22_2.2.4_amd64.deb data.tar.gz | tar xz ./usr",
            "mv usr/share/applications/companion22.desktop usr/share/applications/org.opentx.companion22.desktop",
            "mv usr/share/applications/simulator22.desktop usr/share/applications/org.opentx.simulator22.desktop",
            "desktop-file-install --dir=export/share/applications --set-key=Exec --set-value=/app/bin/companion22 --set-icon=org.opentx.companion22 usr/share/applications/org.opentx.companion22.desktop"
          ]
        },
        {
          "type": "extra-data",
          "filename": "companion22_2.2.4_amd64.deb",
          "only-arches": [
            "x86_64"
          ],
          "url": "https://downloads.open-tx.org/2.2/release/companion/linux/companion22_2.2.4_amd64.deb",
          "sha256": "3cd9f2e9214e13cea5f6eb6183124344aa5d31c58dc79ca2f0448ad116eb6133",
          "size": 20247440
        },
        {
          "type": "file",
          "path": "org.opentx.companion22.appdata.xml"
        },
        {
          "type": "file",
          "path": "usr/local/bin/companion22"
        },
        {
          "type": "file",
          "path": "usr/local/bin/simulator22"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/scalable/apps/companion22.svg"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/16x16/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/22x22/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/24x24/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/32x32/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/48x48/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/128x128/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/256x256/apps/companion22.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/512x512/apps/companion22.png"
        }
      ]
    }
  ]
}

In another wrinkle @refi64, I tried your suggestion of adding extra arguments in the flatpak run command. I tried adding --share=network to the command, and the app could then access the net and successfully check for downloads. To double check I downloaded the latest version of the radio’s firmware and successfully saved it to my PC. However, even though I have --share=network in the finish-args, when I start the app from application menu, it cannot access the net, I get the “cannot check for updates” dialog.
Confusion reigns.
:-\ Ian

Hmm could you just the exact commands you’re using to build and install the flatpak? As for it itself not working, I might try out the manifest tomorrow to see if I can help a bit.

Hi Ryan, this is the run command

flatpak run --share=network org.opentx.companion22 companion22

This is the build command

flatpak-builder --force-clean companion22 org.opentx.companion22.json

Appreciate your help in trying it out, but of course you won’t be able to try reading/writing from a transmitter, as I’m guessing you don’t have ready access to one. So unless you can trick it into thinking something else plugged into a usb port is a transmitter, could be a bit problematic. But at least you may be able to see why it’s not talking to the net.

Another thing I tried was uploading other info from the radio. There are three things; models and settings (load the models and settings from the radio to the PC where they can be changed, then copied back to the radio), backup (make a backup to your PC), and firmware (copy the firmware from the radio to your PC, and you can also update the firmware in the radio by copying it from the PC to the radio). Up till now I had only tried copying models and settings as that’s what I use all the time. I rarely bother with backups, and firmware updates are infrequent. But just for the hell of it I tried the other two options today. Backup didn’t work and gave me the same error message as before, but firmware backup told me /usr/bin/dfu-util was missing. This rung a bell. dfu-util is “device firmware update utilities”, and is required by OpenTx (and other software that talks to microcontroller devices plugged in to usb ports, like, I believe, Arduino development boards) to talk to the device in the radio. To do this the radio has to be in dfu mode (by holding two switches while being switched on). Aha! I thought. That’s it! I just need dfu-util in my manifest and copy it to /app/usr/bin and we’re away laughing.

Unfortunately no. After a bit of to-ing and fro-ing I got a dfu-util binary (and a dfu-prefix and a dfu-suffix) into my directory. Modified the manifest to “install” the three files to /app/usr/bin and tried it. Same problem.

Then another inspiration. I thought the Arduino ide has to use dfu-util, and it’s already a flatpak. Found the manifest and looked through it to see how it handled dfu-util. It’s not there. So either Arduino ide doesn’t need dfu-util as I thought, or it’s handled some other way. More conundra to deal with.

:-\ Ian

On a completely different note, I’ve been trying to use fedmod rpm2flatpak to convert an rpm to a flatpak. However when I enter the command “fedmod rpm2flatpak -c /home/ian/xodbuild/xod-client-electron-0.30.1.x86_64.rpm” (inside a toolbox) I get a message saying “/home/ian/xodbuild/xod-client-electron-0.30.1.x86_64.rpm cannot be found”, however it is definitely in that directory, I’ve double checked ten times. What do I have to do to make it work?
I can “sudo dnf install /home/ian/xodbuild/xod-client-electron-0.30.1.x86_64.rpm” and it works fine.
Thanks,
Ian

Tried a completely different approach. I can download a XOD install file as a .deb, so I’ve been trying to put together a manifest to run flatpak-builder with. Had to make quite a few changes, but eventually got the build to complete with no errors. But when I try to run it I get a “libffmpeg.so” file not found.
So I tried using the kde platform/sdk and the gnome platform/sdk and neither of them contain libffmpeg it seems.

How do I get this file?

@refi64, I’ve solved part of this problem. Bit embarassing actually. When I loaded dfu-util in the manifest, I copied it to /app/usr/bin. Of course it should have been /app/bin. When I changed it I can now read from and write to the transmitter. I can also check for updates and download files from the net. But only if I start the program with the flatpak-builder --run command, and it works without the --share=network option. If I start it from the .desktop however, neither the read/write to the radio nor the access to the net works. Maybe there’s something stuck in the cache that’s not being updated when it should be?
:-\ Ian

Make sure you’re passing --install to flatpak-builder, otherwise it won’t actually update the system Flatpak and will just build it.

Hi @refi64,
Tried doing an install but got a message “Extra data not supported for non-gpg-verified local system installs”. I was using the same (tutorial-repo) as setup in the Building Your First Flatpak guide in the docs).
So I tried to create a repo with gpg verification after a couple more learning curves (never used gpg before) but I think I now have a repo with gpp. Now when I try the install to my new repo I get a message “Unable to load summary from remote mogplus8-repo: GPG verification enabled, but no summary found (check that the configured URL in remote config is correct)”
I have not been able to find out how to create a summary, nor how to check the configured URL in the remote config. “flatpak remote-ls” returns the same message.
I found the “flatpak build-update-repo reponame” command, which worked, but I still get the same message back. I tried the “flatpak build-sign reponame appname” command but that failed as it could not find the app in the repo, presumably because I haven’t installed it yet.
Where to from here?..
:-\

Ah, the easiest way to do this is to use --user which installs to the user-local Flatpak install and therefore doesn’t require GPG verification. However, you may have to reinstall the runtime and SDK in the user install as well (it’s used by passing --user to flatpak).

Thanks yet again @refi64.

The app installed with --user with no problem, and it even appeared in the list of apps displayed by the Gnome 9dot button. However it still will not read and write to the radio. If I run it with “flatpak-builder --run companion22 org.opentx.companion22 companion22” it runs and it will read from and write to the radio. If I run it with “flatpak run org.opentx.companion22” it runs but will not read from or write to the radio. So it seems to me something is going wrong with the install. I’ve tried uninstalling and reinstalling a few times, I’ve also tried deleting the repo and recreating it. Nothing seems to make any difference.
One thing I did notice when I installed the app was that there is nothing mentioned near “devices” in the list of permissions. Could this mean that the --device=all option is not being passed into the install? Just clutching at straws here…

Thanks, Ian

No, that definitely seems right… My best suggestion would honestly be to just ask the developers how this app checks for devices. :confused:

Okay @refi64 I will try that, but I’m not sure their answer will mean anything to me. I’m not a dev. Anyway it never hurts to ask the question I guess.
A new version of the app has been released recently I discovered, 2.3.1, I have been using 2.2.4 up to now. I’ve tried the new release but all the same problems still seem to be occurring.
In the meantime I have hit some other problems.
The main one is it seems the apply_extra script I’ve set up in the manifest is not being executed. The documentation says (indirectly) that it will be run automatically after all the downloads, but it definitely isn’t. I’ve put some echo commands in it to try to debug what’s happening, but none of them ever appear in the output. I’ve compared my manifest to the vscode one, and as far as I can tell (other than one being yaml and the other json) they are identical. All the commands work fine if I run them in a terminal, which is what I have to do before I run flatpak-builder so the directories and files are present and the icons are all renamed.
Here’s the latest manifest:

  "app-id": "org.opentx.companion23",
  "runtime": "org.kde.Platform",
  "runtime-version": "5.12",
  "sdk": "org.kde.Sdk",
  "command": "companion23",
  "tags": [
    "opensource"
  ],
  "finish-args": [
    "--filesystem=home",
    "--socket=x11",
    "--socket=wayland",
    "--device=all",
    "--share=network",
    "--share=ipc"
  ],
  "cleanup": [
    "/include",
    "/lib/pkgconfig",
    "/share/pkgconfig"
  ],
  "modules": [
	{
	    "name": "SDL1",
	    "rm-configure": true,
	    "config-opts": ["--disable-static"],
	    "cleanup": [
	        "/bin",
	        "/share/man",
	        "/share/aclocal",
	        "/include",
	        "/lib/pkgconfig",
	        "/lib/*.la",
	        "/lib/*.a"
	    ],
	    "sources": [
	        {
	            "type": "archive",
	            "url": "https://www.libsdl.org/release/SDL-1.2.15.tar.gz",
	            "sha256": "d6d316a793e5e348155f0dd93b979798933fb98aa1edebcc108829d6474aad00"
	        },
	        {
	            "type": "patch",
	            "path": "sdl-libx11-build.patch"
	        },
	        {
	            "type": "patch",
	            "path": "sdl-check-for-SDL_VIDEO_X11_BACKINGSTORE.patch"
	        },
	        {
	            "type": "script",
	            "dest-filename": "autogen.sh",
	            "commands": [
	                "sed -i -e 's/.*AM_PATH_ESD.*//' configure.in",
	                "cp -p /usr/share/automake-*/config.{sub,guess} build-scripts",
	                "aclocal",
	                "libtoolize",
	                "autoconf"
	            ]
	        }
	    ]
	},
    {
      "name": "glu",
      "config-opts": ["--disable-static"],
      "sources": [
        {
          "type": "archive",
          "url": "https://mesa.freedesktop.org/archive/glu/glu-9.0.0.tar.bz2",
          "sha256": "1f7ad0d379a722fcbd303aa5650c6d7d5544fde83196b42a73d1193568a4df12"
        }
      ],
      "cleanup": [ "/include", "/lib/*.a", "/lib/*.la", "/lib/pkgconfig" ]
    },    
    {
      "name": "companion23",
      "buildsystem": "simple",
      "build-commands": [
        "install -D apply_extra /app/bin/apply_extra",
        "install -D companion23 /app/bin/companion23",
        "install -D dfu-util    /app/bin/dfu-util",
        "install -D dfu-prefix  /app/bin/dfu-prefix",
        "install -D dfu-suffix  /app/bin/dfu-suffix",
        "install -Dm644 org.opentx.companion23.appdata.xml /app/share/appdata/org.opentx.companion23.appdata.xml",
        "install -D companion23.svg /app/share/icons/hicolor/scalable/apps/org.opentx.companion23.svg",
        "install -D companion23-16.png /app/share/icons/hicolor/16x16/org.opentx.companion23.png",
        "install -D companion23-22.png /app/share/icons/hicolor/22x22/org.opentx.companion23.png",
        "install -D companion23-24.png /app/share/icons/hicolor/24x24/org.opentx.companion23.png",
        "install -D companion23-32.png /app/share/icons/hicolor/32x32/org.opentx.companion23.png",
        "install -D companion23-48.png /app/share/icons/hicolor/48x48/org.opentx.companion23.png",
        "install -D companion23-128.png /app/share/icons/hicolor/128x128/org.opentx.companion23.png",
        "install -D companion23-256.png /app/share/icons/hicolor/256x256/org.opentx.companion23.png",
        "install -D companion23-512.png /app/share/icons/hicolor/512x512/org.opentx.companion23.png",
        "install -D /usr/bin/ar /app/bin/ar",
        "install -D /usr/bin/desktop-file-install /app/bin/desktop-file-install",
        "mkdir -p /app/lib",
        "install -D libopentx-*.so /app/lib/"
      ],
      "sources": [
        {
          "type": "script",
          "dest-filename": "apply_extra",
          "commands": [
            "rm -f usr",
            "echo do we ever get in here? Apparently not...",
            "ar p companion23_2.2.4_amd64.deb data.tar.gz | tar xz ./usr",
            "mv usr/share/applications/companion23.desktop usr/share/applications/org.opentx.companion23.desktop",
            "mv usr/share/applications/simulator23.desktop usr/share/applications/org.opentx.simulator23.desktop",
            "for i in 16 22 24 32 48 128 256 512",
            "do",
            "  mv usr/share/icons/hicolor/${i}x${i}/apps/companion23.png usr/share/icons/hicolor/${i}x${i}/apps/companion23-${i}.png",
            "done",
            "desktop-file-install --dir=export/share/applications --set-key=Exec --set-value=/app/bin/companion23 --set-icon=org.opentx.companion23 usr/share/applications/org.opentx.companion23.desktop",
            "rm -f data.tar.gz control.tar.gz debian-binary"
          ]
        },
        {
          "type": "dir",
          "path": "usr/local/lib/companion23"
        },
        {
          "type": "dir",
          "path": "usr/share/applications"
        },
        {
          "type": "file",
          "path": "org.opentx.companion23.appdata.xml"
        },
        {
          "type": "file",
          "path": "usr/local/bin/companion23"
        },
        {
          "type": "file",
          "path": "usr/local/bin/simulator23"
        },
        {
          "type": "file",
          "path": "dfu-util"
        },
        {
          "type": "file",
          "path": "dfu-prefix"
        },
        {
          "type": "file",
          "path": "dfu-suffix"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/scalable/apps/companion23.svg"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/16x16/apps/companion23-16.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/22x22/apps/companion23-22.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/24x24/apps/companion23-24.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/32x32/apps/companion23-32.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/48x48/apps/companion23-48.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/128x128/apps/companion23-128.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/256x256/apps/companion23-256.png"
        },
        {
          "type": "file",
          "path": "usr/share/icons/hicolor/512x512/apps/companion23-512.png"
        }
      ]
    }
  ]
} ```

Thanks, Ian