From cabd538c8ea6a49c1573fb2ee9f221c791e5fa2d Mon Sep 17 00:00:00 2001 From: Mason Lary Date: Thu, 12 Jan 2023 12:22:36 -0500 Subject: [PATCH] Script now checks for success before deleting files --- scripts/Linux/internal/2c_portable.sh | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/scripts/Linux/internal/2c_portable.sh b/scripts/Linux/internal/2c_portable.sh index 80163b82b..fe4305898 100644 --- a/scripts/Linux/internal/2c_portable.sh +++ b/scripts/Linux/internal/2c_portable.sh @@ -1,5 +1,7 @@ #!/bin/bash +shopt -s extglob + SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/.. RESOURCES_PATH=$SCRIPTS_PATH/../../resources INSTALL_PATH=$SCRIPTS_PATH/../../install @@ -29,25 +31,15 @@ then export QMAKE=$QT_DIR/bin/qmake fi -$RESOURCES_PATH/linux/linuxdeploy --appdir=$INSTALL_PATH \ - --plugin qt - -# after deploy, all required libraries are placed into usr/lib, therefore we can remove the ones in -# usr/lib/meshlab (except for the ones that are loaded at runtime) -shopt -s extglob - -# If the script fails for some reason, it causes the deletion of files that weren't meant to be deleted. -# We can fix this with a simple if statement - -if [[ -d $INSTALL_PATH/usr/lib/meshlab ]] -then - +# Make sure that deploy succeeds before we start deleting files +if $RESOURCES_PATH/linux/linuxdeploy --appdir=$INSTALL_PATH --plugin qt; then + # after deploy, all required libraries are placed into usr/lib, therefore we can remove the ones in + # usr/lib/meshlab (except for the ones that are loaded at runtime) cd $INSTALL_PATH/usr/lib/meshlab rm -v !("libIFXCore.so"|"libIFXExporting.so"|"libIFXScheduling.so") echo "$INSTALL_PATH is now a self contained meshlab application" else -#at this point, distrib folder contains all the files necessary to execute meshlab - echo "$INSTALL_PATH/usr/lib/meshlab was not created. Script could not continue running." + echo "linuxdeploy failed with error code $?. Script was not completed successfully." fi