base-image-build/scripts/setupBuilder/main.sh

37 lines
897 B
Bash
Raw Normal View History

2024-08-11 09:09:04 +00:00
#!/bin/bash
export scriptLocation="$(dirname "$0")/"
export utilsLocation="$scriptLocation/../utils"
if [ ! -f $OUTPUT_FILE_PATH ]; then
forceExit() {
exitCode=$1
echo "--- ERROR - Script exited with an error or was interrupted ---"
$utilsLocation/cleanup.sh
echo "--- ERROR - Deleting generated files ---"
rm $OUTPUT_FILE_PATH
exit $exitCode
}
trap "forceExit 0" SIGINT
$scriptLocation/setupBuilder.sh
exitCode=$?
if [[ $exitCode -ne 0 ]];
then
forceExit $exitCode
else
echo "--- SUCCESS - Building the VM disk finished successfully: $OUTPUT_FILE_PATH ---"
# $utilsLocation/cleanup.sh
fi
else
echo "SKIPPING - OUTPUT FILE ALREADY EXISTS - $OUTPUT_FILE_PATH"
echo 'If you need to regenerate it change the $OUTPUT_FILE_PATH make a new commit that changes some of the CI monitored files or delete the pre-generated file'
exit 0
fi