Skip to content

Instantly share code, notes, and snippets.

@probonopd
Last active April 13, 2020 16:02
Show Gist options
  • Save probonopd/41e6a44a58e9090078e6599faa55fea8 to your computer and use it in GitHub Desktop.
Save probonopd/41e6a44a58e9090078e6599faa55fea8 to your computer and use it in GitHub Desktop.

Blackmagic Design Fusion using AppImage

Recently I was informed that Blackmagic Design is using AppImage to distribute Fusion for Linux. So I had a look, and what I found is rather surprising. They hide the fact that they are using AppImage (using .run rather than .AppImage as an extension), and they do not make use of it advantages because they a) encapsulate it in an archive, making unarchiving necessary, and b) run an installer. So they throw away two advantages of AppImages: a) that they do not need to be unpacked, and b) that they do not need to be installed.

What the heck?!

Starting the analysis

I am doing this analyis on Ubuntu 16.04.

sudo mount Blackmagic_Fusion_8.2_installer.run /mnt/ -o loop

AppRun

AppRun looks rather interesting:

#!/bin/sh

CURRENT_DIR=`dirname $0`
# INSTALLER_SCRIPT=$CURRENT_DIR/installer.sh

export PATH=$PATH:$CURRENT_DIR/
export FUSION_PLUGIN_PATH=$CURRENT_DIR/Frameworks

$CURRENT_DIR/FusionInstaller $CURRENT_DIR $@

# Launch the try-out
if [ $? == 77 ]; then
	unset QT_PLUGIN_PATH
	$CURRENT_DIR/Fusion
fi

Why on earth would one produce an AppImage that runs an installer, to only run the application after the installer has ran?

One of the great points is that AppImage allows upstream software authors to distribute software without the need for installation.

This is even more strange as a perfectly valid installed version seems to be inside the AppImage, that can even be started directly:

/mnt/Fusion

However, it is not bundled with everything the software needs to run that cannot be assumed to be part of each base system:

fuscript: error while loading shared libraries: libedit.so.0: cannot open shared object file: No such file or directory

An AppImage should always bundle everything that the software needs to run that cannot be assumed to be part of each base system, in this case, libedit2.

Fixing the AppImage

Luckily, the AppImage can be fixed rather easily:

# Unpack existing AppImage

mkdir Fusion/
cd Fusion/
sudo mount ../Blackmagic_Fusion_8.2_installer.run /mnt/ -o loop
cp -r /mnt Fusion.AppDir

# Bundle missing library

wget -c "http://ftp.us.debian.org/debian/pool/main/libe/libedit/libedit2_2.11-20080614-5_amd64.deb"
dpkg -x *deb .
cp usr/lib/x86_64-linux-gnu/libedit.so.2 Fusion.AppDir/libedit.so.0

# Fix AppRun

cat > "Fusion.AppDir/AppRun" <<\EOF
#!/bin/sh

CURRENT_DIR="$(dirname "$(readlink -f "${0}")")"

export PATH=$PATH:$CURRENT_DIR/
export FUSION_PLUGIN_PATH=$CURRENT_DIR/Frameworks

unset QT_PLUGIN_PATH
cd $CURRENT_DIR
"$CURRENT_DIR/Fusion" $@
EOF

# Delete unneccessary installer

rm ./Fusion.AppDir/FusionInstaller

# Fix desktop file (no /opt needed in our case!)

sed -i -e 's|/opt/Fusion/||g' Fusion.AppDir/Fusion.desktop 

# Generate fixed AppImage and name it according to the spec

VERSION=8.2
ARCH=$(arch)
APP=Fusion
wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
. ./functions.sh
generate_appimage
mv ../out/Fusion-8.2-x86_64.AppImage ../out/Blackmagic_Fusion-8.2-x86_64.AppImage

# Test run

../out/Blackmagic_Fusion-8.2-x86_64.AppImage

Ready to be uploaded. Please not not put it inside an archive!

Next steps

The upstream developers might want to:

  • Integrate with the desktop by installing the desktop file upon the first application launch. Have a look at the desktopintegration script (which cannot be used 1:1 unchanged here since it assumes a certain directory structure to be present in usr/ inside the AppImage which is not the case here)
  • Use AppImageUpdate and include update information in the AppImage to make binary delta updates trivially eays
@gree303
Copy link

gree303 commented Sep 28, 2016

I'm having some issues. After executing the bash; I'm getting the following error. As soon it is starting with the .appimage generation:
Icon could not be found based on information in desktop file, aborting mv: cannot stat ‘../out/Fusion-8.2-x86_64.AppImage’: No such file or directory ./fusionappimage.sh: 49: ./fusionappimage.sh: ../out/Blackmagic_Fusion-8.2-x86_64.AppImage: not found
Edit: I've created the File "Fusion-8.2-x86_64.AppImage" with the script you shared.
But instead of generating the file "Blackmagic_Fusion-8.2-x86_64.AppImage" it gets deleted.
Do you see what I'm missing out here? Thanks.

@probonopd
Copy link
Author

@gree303 sorry I saw your comment only now. Probably the icon file needs to be copied to the root of the AppDir, something I might have forgotten to document above but should be trivial.

@probonopd
Copy link
Author

There is now Blackmagic Fusion 9.0 but again it is behind a registration wall so I don't know what is inside https://www.blackmagicdesign.com/products/fusion/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment