Exit with error code if AppImage creation fails midair

This commit is contained in:
Janek Bevendorff 2020-01-20 22:46:50 +01:00
parent b34a8f9d94
commit b6ff613189

View File

@ -616,11 +616,9 @@ appimage() {
fi fi
if [ ! -d "${appdir}" ]; then if [ ! -d "${appdir}" ]; then
logError "AppDir does not exist, please create one with 'make install'!\n" exitError "AppDir does not exist, please create one with 'make install'!"
exit 1
elif [ -e "${appdir}/AppRun" ]; then elif [ -e "${appdir}/AppRun" ]; then
logError "AppDir has already been run through linuxdeploy, please create a fresh AppDir with 'make install'.\n" exitError "AppDir has already been run through linuxdeploy, please create a fresh AppDir with 'make install'."
exit 1
fi fi
appdir="$(realpath "$appdir")" appdir="$(realpath "$appdir")"
@ -652,14 +650,18 @@ appimage() {
logInfo "Downloading linuxdeploy..." logInfo "Downloading linuxdeploy..."
linuxdeploy="./linuxdeploy" linuxdeploy="./linuxdeploy"
linuxdeploy_cleanup="rm -f ${linuxdeploy}" linuxdeploy_cleanup="rm -f ${linuxdeploy}"
curl -L "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" > "$linuxdeploy" if ! curl -Lf "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" > "$linuxdeploy"; then
exitError "linuxdeploy download failed."
fi
chmod +x "$linuxdeploy" chmod +x "$linuxdeploy"
fi fi
if ! ${docker_test_cmd} which ${linuxdeploy_plugin_qt} &> /dev/null; then if ! ${docker_test_cmd} which ${linuxdeploy_plugin_qt} &> /dev/null; then
logInfo "Downloading linuxdeploy-plugin-qt..." logInfo "Downloading linuxdeploy-plugin-qt..."
linuxdeploy_plugin_qt="./linuxdeploy-plugin-qt" linuxdeploy_plugin_qt="./linuxdeploy-plugin-qt"
linuxdeploy_plugin_qt_cleanup="rm -f ${linuxdeploy_plugin_qt}" linuxdeploy_plugin_qt_cleanup="rm -f ${linuxdeploy_plugin_qt}"
curl -L "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" > "$linuxdeploy_plugin_qt" if ! curl -Lf "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" > "$linuxdeploy_plugin_qt"; then
exitError "linuxdeploy-plugin-qt download failed."
fi
chmod +x "$linuxdeploy_plugin_qt" chmod +x "$linuxdeploy_plugin_qt"
fi fi
@ -668,7 +670,9 @@ appimage() {
logInfo "Downloading appimagetool..." logInfo "Downloading appimagetool..."
appimagetool="./appimagetool" appimagetool="./appimagetool"
appimagetool_cleanup="rm -f ${appimagetool}" appimagetool_cleanup="rm -f ${appimagetool}"
curl -L "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" > "$appimagetool" if ! curl -Lf "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" > "$appimagetool"; then
exitError "appimagetool download failed."
fi
chmod +x "$appimagetool" chmod +x "$appimagetool"
fi fi
@ -718,6 +722,10 @@ EOF
--library=\$(ldconfig -p | grep x86-64 | grep -oP '/[^\s]+/libgpg-error\.so\.\d+$' | head -n1)" --library=\$(ldconfig -p | grep x86-64 | grep -oP '/[^\s]+/libgpg-error\.so\.\d+$' | head -n1)"
fi fi
if [ $? -ne 0 ]; then
exitError "AppDir deployment failed."
fi
logInfo "Creating AppImage..." logInfo "Creating AppImage..."
local appsign_flag="" local appsign_flag=""
local appsign_key_flag="" local appsign_key_flag=""
@ -737,8 +745,10 @@ EOF
# Run appimagetool to package (and possibly sign) AppImage # Run appimagetool to package (and possibly sign) AppImage
# --no-appstream is required, since it may crash on newer systems # --no-appstream is required, since it may crash on newer systems
# see: https://github.com/AppImage/AppImageKit/issues/856 # see: https://github.com/AppImage/AppImageKit/issues/856
"$appimagetool" --updateinformation "gh-releases-zsync|keepassxreboot|keepassxc|latest|KeePassXC-*-x86_64.AppImage.zsync" \ if ! "$appimagetool" --updateinformation "gh-releases-zsync|keepassxreboot|keepassxc|latest|KeePassXC-*-x86_64.AppImage.zsync" \
${appsign_flag} ${appsign_key_flag} --no-appstream "$appdir" "${out_real}/${appimage_name}" ${appsign_flag} ${appsign_key_flag} --no-appstream "$appdir" "${out_real}/${appimage_name}"; then
exitError "AppImage creation failed."
fi
logInfo "Cleaning up temporary files..." logInfo "Cleaning up temporary files..."
${linuxdeploy_cleanup} ${linuxdeploy_cleanup}
@ -906,7 +916,7 @@ build() {
if ! ${build_snapshot} && [ -e "${OUTPUT_DIR}/build-release" ]; then if ! ${build_snapshot} && [ -e "${OUTPUT_DIR}/build-release" ]; then
logInfo "Cleaning existing build directory..." logInfo "Cleaning existing build directory..."
rm -r "${OUTPUT_DIR}/build-release" 2> /dev/null rm -rf "${OUTPUT_DIR}/build-release" 2> /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exitError "Failed to clean existing build directory, please do it manually." exitError "Failed to clean existing build directory, please do it manually."
fi fi