Skip to content

Instantly share code, notes, and snippets.

@zilti
Last active March 23, 2019 17:57
Show Gist options
  • Save zilti/b5937ebd68fcbb02f8de6b5b7c9aa79b to your computer and use it in GitHub Desktop.
Save zilti/b5937ebd68fcbb02f8de6b5b7c9aa79b to your computer and use it in GitHub Desktop.
AppImage creation script for CKAN
#!/usr/bin/env bash
HERE="$(dirname "$(readlink -f "${0}")")"
echo $HERE
export PATH=${HERE}/usr/sbin:${HERE}/usr/bin:$PATH
export LD_LIBRARY_PATH=$HERE/usr/lib64:$HERE/usr/lib:$HERE/lib64:$LD_LIBRARY_PATH
export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH:$DYLD_FALLBACK_LIBRARY_PATH
export LD_RUN_PATH=$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$HERE/usr/lib64/pkgconfig:$PKG_CONFIG_PATH
export MONO_GAC_PREFIX=${HERE}
export MONO_PATH=${HERE}/usr/lib/mono/4.5
export MONO_CONFIG=${HERE}/usr/etc/mono/config
export MONO_CFG_DIR=${HERE}/usr/etc
export C_INCLUDE_PATH=${HERE}/usr/include
export ACLOCAL_PATH=${HERE}/usr/share/aclocal
export FONTCONFIG_PATH=${HERE}/usr/etc/fonts
export XDG_CONFIG_HOME=${HERE}/.config
export TERM=xterm
mono $HERE/usr/bin/ckan.exe "$@"
#!/usr/bin/env bash
[ -f "linuxdeploy" ] || curl -L https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -o linuxdeploy && chmod +x linuxdeploy
[ -f "appimagetool" ] || curl -L https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -o appimagetool && chmod +x appimagetool
rm -rf AppDir
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/lib
mkdir -p AppDir/usr/etc/fonts/CKAN/downloads
mkdir -p AppDir/usr/share
wget https://github.com/KSP-CKAN/CKAN/releases/download/v1.25.4/ckan.exe
wget https://github.com/KSP-CKAN/CKAN/raw/master/assets/ckan-256.png
wget https://download.mono-project.com/runtimes/raw/mono-5.10.0-debian-7-x64
mv ckan.exe AppDir/usr/bin
mv ckan-256.png ckan.png
cp -r /usr/share/.mono AppDir/usr/share
chmod +x AppRun
cd AppDir/usr
unzip ../../mono-5.10.0-debian-7-x64
cd ../..
rm mono-5.10.0-debian-7-x64
export ARCH=x86_64
export UPDATE_INFORMATION="gh-releases-zsync|KSP-CKAN|CKAN|latest|ckan.AppImage.zsync"
./linuxdeploy --appdir=AppDir --custom-apprun=AppRun --desktop-file=ckan.desktop --icon-file=ckan.png -l/usr/lib64/libgdiplus.so.0 -oappimage
[Desktop Entry]
Name=CKAN
GenericName=Mod Organizer
Comment=The Comprehensive Kerbal Archive Network
Exec=AppimageLauncher %F
Icon=ckan
Type=Application
Terminal=false
Categories=Game;Utility;
X-AppImage-Version=1.25.4
@zilti
Copy link
Author

zilti commented Feb 2, 2019

So if you want this to pack into an AppImage properly, the system doing the packing will need to have libgdiplus installed. Ideally also Mono, because despite we're not using the system-provided mono, the script fetches the SSL certificates from the system mono, since the runtime doesn't ship with them.

@Cyclic3
Copy link

Cyclic3 commented Feb 3, 2019

@zilti Can we not use /etc/ssl/certs? That's part of openssl I believe, and I am certain not part of mono. Also, why can't we fetch the gdiplus library?

@Cyclic3
Copy link

Cyclic3 commented Feb 3, 2019

Could we not curl the gdiplus package from debian stable and unpack it into the appimage?

@Cyclic3
Copy link

Cyclic3 commented Feb 3, 2019

Also the path for libgdiplus is not platform agnostic (it does not work on debian nor ubuntu)

@zilti
Copy link
Author

zilti commented Feb 3, 2019

Yes, we could curl gdiplus. About the certs... The thing is that Mono does not use the system certs, but brings its own.

@zilti
Copy link
Author

zilti commented Feb 3, 2019

(And the path for libgdiplus does not have to be platform agnostic; it only has to be correct on the platform on which the AppImage is built. linuxdeploy takes the library at that path and includes it into the AppImage.)

@Cyclic3
Copy link

Cyclic3 commented Feb 6, 2019

@zilti gdiplus was in a different place on my machine, which caused me a minute of confusion when it said it couldn't find it. If we use the system version, why not use a quick locate libgdiplus.so | head -n1?

@zilti
Copy link
Author

zilti commented Mar 23, 2019

Ah, having no notifications on gist.github.com is annoying... Sure, you can do that, just put it into backticks inside the expression:

./linuxdeploy --appdir=AppDir --custom-apprun=AppRun --desktop-file=ckan.desktop --icon-file=ckan.png -l`locate libgdiplus.so | head -n1` -oappimage

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