Convert .deb to Flatpak?

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

Ugh I keep forgetting, but I’ll give it a spin tomorrow and see what’s going on.

Whoops. found a bug. source deb has the wrong name… Noob mistake…

And fixing it made no difference… :frowning:

BTW the version number was wrong. it was companion23_2.2.4… it should be companion23_2.3.1…

Thought I’d cracked it again. I’m pretty sure the udev rules were never copied to the right place. Maybe they still aren’t. I added this to the manifest but not sure if it’s right. And it still doesn’t work.

        "mkdir -p /app/lib/udev/",
        "mkdir -p /app/lib/udev/rules.d/",
        "install -D 45-companion23-taranis.rules -t /app/lib/udev/rules.d/",
        "install -D 45-companion23-usbasp.rules -t /app/lib/udev/rules.d/",
        "install -D 45-companion23-taranis.rules -t /etc/udev/rules.d/",
        "install -D 45-companion23-usbasp.rules -t /etc/udev/rules.d/" 

Still trying…

Then I tried this

        "install -D 45-companion23-taranis.rules -t /app/usr/lib/udev/rules.d/",
        "install -D 45-companion23-usbasp.rules -t /app/usr/lib/udev/rules.d/",
        "install -D 45-companion23-taranis.rules -t /app/etc/udev/rules.d/",
        "install -D 45-companion23-usbasp.rules -t /app/etc/udev/rules.d/"

That didn’t work either… :frowning:

@refi64,
I got a response from the OpenTx forum from a guy called Kilrah. He is one of the lead developers of OpenTx so he is the gun. He said “For everything happening with radio on it’s just listing/reading/writing files from/to a mass storage drive, nothing special.
The files on the virtual EEPROM drive are marked as system I believe though, so it must have the permissions to access those.”
:slight_smile:

Okay so I was finally going to try this out myself, but then I noticed you had a bunch of lines like this:


        {
          "type": "dir",
          "path": "usr/local/lib/companion23"
        },
        {
          "type": "dir",
          "path": "usr/share/applications"
        },

This is basically pulling companion23 from your host system entirely, which makes it kinda hard for me to try…

Also, apply_extra is only run if you have an extra-data source in your manifest.