From b6ff61318984d56a591343271f1a3b8a1f521678 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Mon, 20 Jan 2020 22:46:50 +0100 Subject: [PATCH] Exit with error code if AppImage creation fails midair --- release-tool | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/release-tool b/release-tool index f6b8c8e27..48ca14b76 100755 --- a/release-tool +++ b/release-tool @@ -616,11 +616,9 @@ appimage() { fi if [ ! -d "${appdir}" ]; then - logError "AppDir does not exist, please create one with 'make install'!\n" - exit 1 + exitError "AppDir does not exist, please create one with 'make install'!" elif [ -e "${appdir}/AppRun" ]; then - logError "AppDir has already been run through linuxdeploy, please create a fresh AppDir with 'make install'.\n" - exit 1 + exitError "AppDir has already been run through linuxdeploy, please create a fresh AppDir with 'make install'." fi appdir="$(realpath "$appdir")" @@ -652,14 +650,18 @@ appimage() { logInfo "Downloading linuxdeploy..." linuxdeploy="./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" fi if ! ${docker_test_cmd} which ${linuxdeploy_plugin_qt} &> /dev/null; then logInfo "Downloading linuxdeploy-plugin-qt..." linuxdeploy_plugin_qt="./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" fi @@ -668,7 +670,9 @@ appimage() { logInfo "Downloading appimagetool..." appimagetool="./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" fi @@ -718,6 +722,10 @@ EOF --library=\$(ldconfig -p | grep x86-64 | grep -oP '/[^\s]+/libgpg-error\.so\.\d+$' | head -n1)" fi + if [ $? -ne 0 ]; then + exitError "AppDir deployment failed." + fi + logInfo "Creating AppImage..." local appsign_flag="" local appsign_key_flag="" @@ -737,8 +745,10 @@ EOF # Run appimagetool to package (and possibly sign) AppImage # --no-appstream is required, since it may crash on newer systems # see: https://github.com/AppImage/AppImageKit/issues/856 - "$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}" + 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}"; then + exitError "AppImage creation failed." + fi logInfo "Cleaning up temporary files..." ${linuxdeploy_cleanup} @@ -906,7 +916,7 @@ build() { if ! ${build_snapshot} && [ -e "${OUTPUT_DIR}/build-release" ]; then 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 exitError "Failed to clean existing build directory, please do it manually." fi