mirror of
https://gitlab.com/monolithify/base-image-build.git
synced 2024-11-28 22:06:26 +00:00
37 lines
897 B
Bash
37 lines
897 B
Bash
#!/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
|