Convert .deb to Flatpak?

Apologies is this has been covered elsewhere, I did several searches and couldn’t find anything that addressed this issue.
I have a particular application I’d like to install that is only available as a .deb, not even a .rpm. (OpenTX Companion if you are interested) and I was wondering if there is any way I can install it on SilverBlue. And more generally, is there a relatively easy, not too technical way to install any .deb on SB? Just curious, I’m just starting out on my SilverBlue adventure.
Thanks, Ian

1 Like

.deb files are only for Debian and derivatives; Fedora instead uses the rpm packaging format in line with Red Hat and SUSE derivatives. There are technically ways of converting between them automatically (such as alien), but that can unsurprisingly result in package files that are a bit of a mess.

That being said, it is possibly to manually build a Flatpak (or RPM though that’s not nearly as fun) by extracting the contents of a deb package, which is what the Visual Studio Code Flatpak does.

1 Like

Thanks for the reply @refi64. Now you’ve sent me off on another steep learning curve! flatpak-builder here I come…
:wink:

1 Like

Haha, if you need help you can usually check out the sources to Flathub’s manifests here.

Thanks @refi64. On a slightly different note, how about .rpms? Is it easier to convert them to flatpaks? I had a look inside one, almost as confusing as a .deb.
:wink:

You can (still by extracting as usual), however if you’re trying to convert a Fedora app to be a Flatpak, you might be better off using the Fedora Flatpak build mechanism which builds Flatpaks from RPMs. The Flatpak core itself isn’t tied to a particular build mechanism; both flatpak-builder and fedmod rpm2flatpak can be used equally.

However, in general, Fedora-style Flatpaks are created for the Fedora-specific Flatpak repo, and flatpak-builder Flatpaks are the only ones accepted into Flathub.

Well I’ve had much fun trying to put together a flatlpak-builder file. I got quite a long way with it, but now stuck. I copied a file (can’t remember what is was now, sorry) which had a reference to libudev1 in it and a file with udev rules in it. Since the package I’m trying to install also has udev rules (two of them) I just changed the names and locations. Now when I try to build it with flatpak-builder I get an error message on these files saying "can’t find autogen, autogen.sh or bootstrap. No idea how to get past this problem…

This is my .json file.
{
“app-id”: “org.opentx.companion”,
“runtime”: “org.freedesktop.Platform”,
“runtime-version”: “18.08”,
“sdk”: “org.freedesktop.Sdk”,
“command”: “companion22”,
“tags”: [
“opensource”
],
“finish-args”: [
“–filesystem=home”,
“–socket=x11”,
“–device=dri”,
“–share=ipc”
],
“cleanup”: [
“/include”,
“/lib/pkgconfig”,
“/share/pkgconfig”
],
“modules”: [
{
“name”: “companion22”,
“buildsystem”: “simple”,
“build-commands”: [
“install -D apply_extra /app/bin/apply_extra”,
“install -D companion22 /app/bin/companion22”,
“install -Dm644 org.opentx.companion.appdata.xml /app/share/appdata/org.opentx.companion.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.xz | tar xJ”,
“rm -f companion22_2.2.4_amd64.deb”,
"mv usr/
.”,
“rmdir usr”,
“mv share/applications/companion22.desktop share/applications/org.opentx.companion.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.companion.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.companion.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”
}
]
},
{
“name”: “libudev1”,
“buildsystem”: “autotools”,
“sources”: [
{
“type”: “file”,
“path”: “data/lib/udev/rules.d/45-companion22-taranis.rules”
}
]
},
{
“name”: “libudev2”,
“buildsystem”: “autotools”,
“sources”: [
{
“type”: “file”,
“path”: “data/lib/udev/rules.d/45-companion22-usbasp.rules”
}
]
}

]
}

First off: you can actually format code blocks on Discourse by adding a line of three backticks before and after the code in question.

There are two things about this manifest file:

  • The buildsystem type on both your udev rules is autotools, but the only source that each rule has is a single udev rules file. There are no autotools build scripts, therefore the build fails.
  • udev…doesn’t actually work inside Flatpaks. Relevant GitHub issue here.

Hi @refi64, thanks for the reply. I used the “preformatted text” thingy to paste the text in, I thought that was for code.
I wish I could find the original .json that I copied, but it seems to have vanished into cyberspace. It had another thing it I didn’t understand too, something called “glu-9.0.0.something”. I deleted it as I couldn’t find any reference to it, and figured I could always add it in again later if I could ever find out what it did and if I needed it or not.
But now it seems the udev thing is a show stopper for me. OpenTx Companion is for programming radio control transmitters that run OpenTx firmware, and as such needs to communicate with the transmitter when it is plugged in via usb port. From my limited understanding that (currently) isn’t possible with a flatpak? What about things like GPS devices, cameras, phones, joysticks etc. in fact any device at all that can be plugged into a usb slot. Can they also not be used with flatpak packages? That seems a bit limiting, or do I have completely the wrong end of the stick?
:frowning: Ian

If one of your modules is just the path to a file, that file’s contents are used as a module. In this case, that was probably the path to a json module from flathub/shared-modules that installs the GLU libraries.

Flatpaks can be granted access to all host devices via the permission --device=all. It’s just udev in particular (which provides stuff like hotplug APIs) doesn’t work.

Thanks for that @refi64. I looked at the link you gave me, and it talks about adding a git submodule. I’m not entirely sure what that means or how to do it. I haven’t really used git so I’m a bit lost here.

Anyway I looked at the shared-modules library and found a folder called glu. Had a look in that and it had what appeared to be a flatpak manifest like json module description, so I copy and pasted that into my manifest in the modules section and ran flatpak-builder again. It seems to have built the library (with a couple of compiler warnings), so I’m assuming that all worked.

I still can’t figure the udev bit, so I thought I’ll see if I can copy the udev files into /etc/udev/rules.d (which was what I thought was ll that needed to happen) as per normal linux. I thought /etc was locked down in SB so I didn’t hold out much hope, but waddya know, it worked! So I deleted all that udev stuff from the manifest and ran it again. After a couple of false starts it worked! Crack open the champagne!!

So I tried running it. Recork the champagne. Now it says it can’t find libQt5Multimedia.so.5. I’ve got a funny feeling this isn’t the only file it’s not going to be able to find…

What do I do now?
Thanks, Ian

Well it’s progress ¯\_(ツ)_/¯.

The default Flatpak runtime indeed doesn’t have Qt installed, but the KDE one does. Try switching the runtime/sdk to org.kde.Platform/org.kde.Sdk and the runtime-version to 5.16. (You may have to install the platform and sdk separately.)

@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"
        }
      ]
    }
  ]
}