AppImage 是一种在 Linux 系统中用于分发便携式软件,且不需要超级用户权限来安装它们的格式。它还允许 Linux 的上游开发者来分发他们的程序而不用考虑不同 Linux 发行版间的区别。AppImage 的核心思想是一个文件即一个应用程序,每个 AppImage 都包含应用程序以及应用程序运行所需的所有文件。
Application Options: -l, --list List files in SOURCE AppImage -u, --updateinformation Embed update information STRING; if zsyncmake is installed, generate zsync file -g, --guess Guess update information based on Travis CI or GitLab environment variables --bintray-user Bintray user name --bintray-repo Bintray repository --version Show version number -v, --verbose Produce verbose output -s, --sign Sign with gpg[2] --comp Squashfs compression -n, --no-appstream Do not check AppStream metadata --exclude-file Uses given file as exclude file for mksquashfs, in addition to .appimageignore. --runtime-file Runtime file to use --sign-key Key ID to use for gpg[2] signatures --sign-args Extra arguments to use when signing with gpg
# Using ingredients from a binary archive ingredients: script: -DLD=$(wget-q"https://api.github.com/repos/atom/atom/releases/latest"-O-|grep-E"https.*atom-amd64.tar.gz"|cut-d'"'-f4) -wget-c$DLD -tarzxvfatom*tar.gz
1 2 3 4 5 6
# Using ingredients from a debian repository ingredients: dist:xenial sources: -debhttp://archive.ubuntu.com/ubuntu/xenialmainuniverse -debhttp://download.opensuse.org/repositories/isv:/KDAB/xUbuntu_16.04//
1 2 3 4 5 6 7
# Using ingredients from an Ubuntu PPA ingredients: dist:xenial sources: -debhttp://us.archive.ubuntu.com/ubuntu/xenialmainuniverse ppas: -geany-dev/ppa
1 2 3 4 5 6 7 8
# Using local deb files ingredients: dist:xenial sources: -debhttp://us.archive.ubuntu.com/ubuntu/xenialmainuniverse debs: -/home/area42/kdenlive.deb -/home/area42/kdenlive/*
# The script section needs to copy ingredients into place ingredients: script: -wget-c"https://telegram.org/dl/desktop/linux"--trust-server-names -tarxftsetup.*.tar.xz
# The script section needs to copy icon and .desktop file in place script: -tarxf../fritzing*-Cusr/bin/--strip1 -mvusr/bin/fritzing.desktop.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# The script section needs to copy icon and .desktop file in place script: -# Workaround for: -# https://bugzilla.mozilla.org/show_bug.cgi?id=296568 -cat>firefox.desktop<<EOF -[DesktopEntry] -Type=Application -Name=Firefox -Icon=firefox -Exec=firefox%u -Categories=GNOME;GTK;Network;WebBrowser; -MimeType=text/html;text/xml;application/xhtml+xml; -StartupNotify=true -EOF
1 2 3 4 5 6 7 8
# The script section needs to copy icon and .desktop file in place script: -cp./usr/share/applications/FBReader.desktopfbreader.desktop -sed-i-e's|Exec=FBReader|Exec=fbreader|g'fbreader.desktop -sed-i-e's|Name=.*|Name=FBReader|g'fbreader.desktop -sed-i-e's|Icon=.*|Icon=fbreader|g'fbreader.desktop -mvusr/bin/FBReaderusr/bin/fbreader -cpusr/share/pixmaps/FBReader.pngfbreader.png
# fetch sources (you could as well use a tarball etc.) > git clone https://github.com/linuxdeploy/QtQuickApp.git > cd QtQuickApp
# build out of source > mkdir build > cd build
# configure build system # the flags below are the bare minimum that is needed, the app might define additional variables that might have to be set > cmake .. -DCMAKE_INSTALL_PREFIX=/usr
# build the application on all CPU cores > make -j$(nproc)
# now "install" resources into future AppDir > make install DESTDIR=AppDir
# building in temporary directory to keep system clean # use RAM disk if possible (as in: not building on CI system like Travis, and RAM disk is available) if [ "$CI" == "" ] && [ -d /dev/shm ]; then TEMP_BASE=/dev/shm else TEMP_BASE=/tmp fi
# make sure to clean up build dir, even if errors occur cleanup () { if [ -d "$BUILD_DIR" ]; then rm -rf "$BUILD_DIR" fi } trap cleanup EXIT
# store repo root as variable REPO_ROOT=$(readlink -f $(dirname $(dirname $0))) OLD_CWD=$(readlink -f .)
# switch to build dir pushd"$BUILD_DIR"
# configure build files with CMake # we need to explicitly set the install prefix, as CMake's default is /usr/local for some reason... cmake "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr
# build project and install files into AppDir make -j$(nproc) make install DESTDIR=AppDir
# now, build AppImage using linuxdeploy and linuxdeploy-plugin-qt # download linuxdeploy and its Qt plugin wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
# make them executable chmod +x linuxdeploy*.AppImage
# make sure Qt plugin finds QML sources so it can deploy the imported files export QML_SOURCES_PATHS="$REPO_ROOT"/src
# initialize AppDir, bundle shared libraries for QtQuickApp, use Qt plugin to bundle additional resources, and build AppImage, all in one single command ./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin qt --output appimage
# move built AppImage back into original CWD mv QtQuickApp*.AppImage "$OLD_CWD"