Add error handling to make-os scripts

This commit is contained in:
Fierelier 2022-05-10 22:53:09 +02:00
parent f795751c1e
commit 6fa36fc33b
2 changed files with 52 additions and 28 deletions

12
make-os
View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
set -e
if
if [ "$1" = "" ]; then
echo "Define i386/amd64 as the first argument."
exit 1
@ -12,3 +14,13 @@ apply-stage "$OPUS_HOME/input/stage50" "$OPUS_OUTPUT/$1" # Packages (graphical)
apply-stage "$OPUS_HOME/input/stage98" "$OPUS_OUTPUT/$1" # Default configs, etc.
apply-stage "$OPUS_HOME/input/stage99" "$OPUS_OUTPUT/$1" # Disk image preparation
make-image "$OPUS_OUTPUT/$1" "$OPUS_OUTPUT/${OPUS_NAME}-${OPUS_DIST}-${OPUS_ARCH}_$(date "+%Y.%m.%d-%H.%M.%S").img" # Disk image
then
set +e
else
set +e
echo
echo Script execution ended due to error. Cleaning up...
fchroot-end "$OPUS_OUTPUT/$1"
rm -r "$OPUS_OUTPUT/$1"
echo Script execution ended due to error.
fi

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
set -e
if
if [ "$1" = "" ]; then
echo "Define i386/amd64 as the first argument."
exit 1
@ -14,3 +16,13 @@ apply-stage "$OPUS_HOME/input/stage50" "$OPUS_OUTPUT/$1" # Packages (graphical)
apply-stage "$OPUS_HOME/input/stage98" "$OPUS_OUTPUT/$1" # Default configs, etc.
apply-stage "$OPUS_HOME/input/stage99" "$OPUS_OUTPUT/$1" # Disk image preparation
make-image "$OPUS_OUTPUT/$1" "$OPUS_OUTPUT/${OPUS_NAME}-${OPUS_DIST}-${OPUS_ARCH}_$(date "+%Y.%m.%d-%H.%M.%S").img" # Disk image
then
set +e
else
set +e
echo
echo Script execution ended due to error. Cleaning up...
fchroot-end "$OPUS_OUTPUT/$1"
rm -r "$OPUS_OUTPUT/$1"
echo Script execution ended due to error.
fi