Create a function for killing the installer

This commit is contained in:
Manuel Thalmann 2023-03-25 23:19:07 +01:00
parent a273143d5c
commit 2721d67eb9

View file

@ -102,7 +102,7 @@ RUN \
sleep 1; \ sleep 1; \
done; \ done; \
# Kill installer after timeout indicated by `maxCount` # Kill installer after timeout indicated by `maxCount`
[ "$x" -eq "$maxCount" ] && { pkill -9 "$installerName"; mv "$logFile" "$logDir/timeout-try$try.log"; }; \ [ "$x" -eq "$maxCount" ] && { kill_installer; mv "$logFile" "$logDir/timeout-try$try.log"; }; \
} & \ } & \
}; \ }; \
wait "$pid"; \ wait "$pid"; \
@ -144,12 +144,15 @@ RUN \
-e ":end q;"; \ -e ":end q;"; \
exitCode="$?"; \ exitCode="$?"; \
# Kill installer if it got stuck (according to console output) # Kill installer if it got stuck (according to console output)
[ "$exitCode" -eq 42 ] && pkill -9 "$installerName"; \ [ "$exitCode" -eq 42 ] && kill_installer; \
# Use `sed`s exit code if non-zero # Use `sed`s exit code if non-zero
[ "$exitCode" -ne 0 ] && exit "$exitCode" || \ [ "$exitCode" -ne 0 ] && exit "$exitCode" || \
# Return true otherwise # Return true otherwise
true; \ true; \
}; \ }; \
kill_installer() { \
pkill -9 "$installerName" > /dev/null 2>&1; \
}; \
display=:90; \ display=:90; \
export DISPLAY="$display"; \ export DISPLAY="$display"; \
mkdir -p --mode=777 /tmp/.X11-unix; \ mkdir -p --mode=777 /tmp/.X11-unix; \