Commit 4f6ccbd4 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Error trap

parent a71ff45b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -10,11 +10,11 @@ set -Eeuo pipefail
: ${DISK_SIZE:='16G'}   # Initial data disk size
: ${RAM_SIZE:='512M'}   # Maximum RAM amount

echo "❯ Starting Virtual DSM for Docker v${VERSION}..."

info () { echo -e "\E[1;34m❯ \E[1;36m$1\E[0m" ; }
error () { echo -e >&2 "\E[1;31m❯ ERROR: $1\E[0m" ; }

echo "❯ Starting Virtual DSM for Docker v${VERSION}..."
trap 'error "Error status $? for: ${BASH_COMMAND} (line $LINENO/$BASH_LINENO)"' ERR
trap 'error "Status $? while: ${BASH_COMMAND} (line $LINENO/$BASH_LINENO)"' ERR

[ ! -f "/run/run.sh" ] && error "Script must run inside Docker container!" && exit 11
[ "$(id -u)" -ne "0" ] && error "Script must be executed with root privileges." && exit 12