summaryrefslogtreecommitdiffstats
path: root/packager/openslx
diff options
context:
space:
mode:
Diffstat (limited to 'packager/openslx')
-rwxr-xr-xpackager/openslx17
1 files changed, 12 insertions, 5 deletions
diff --git a/packager/openslx b/packager/openslx
index a71a1db6..9613196b 100755
--- a/packager/openslx
+++ b/packager/openslx
@@ -10,21 +10,22 @@
#
# ------------------------------------------------------------------------------
#
-# OpenSLX-NG Main Code
+# Main Code
#
# ------------------------------------------------------------------------------
declare -rg ARG0="$0"
-declare -rg SELF="$(readlink -f "$ARG0")"
+declare -rg SELF="$(readlink -f "${ARG0}")"
declare -rg ROOT_DIR="$(dirname "${SELF}")"
declare -rg SELF_PID="$$"
# let's keep it simple for now, just source our config/functions file
-. "${ROOT_DIR}/$ARG0".functions || perror "Could not source functions."
-. "${ROOT_DIR}/$ARG0".config || perror "Could not source config."
+. "${ROOT_DIR}/${ARG0}".functions || perror "Could not source functions."
+. "${ROOT_DIR}/${ARG0}".config || perror "Could not source config."
# root check
if [ "$(id -u)" -ne 0 ]; then
+ banner
perror "ERROR: You need to be root to use this toolkit."
else
banner
@@ -32,11 +33,17 @@ fi
# do we even have tools?
for TOOL in qemu-img qemu-nbd mkfs.ext4; do
- which $TOOL &>/dev/null || perror "Could not find '$TOOL'."
+ which "${TOOL}" &>/dev/null || \
+ perror "Could not find '${TOOL}'. Please install it."
done
+# setup trap
+trap cleanexit SIGINT SIGTERM
+# read params
read_params $@
+
+# react to given action
if [ "x$ACTION" == "xCLONE" ]; then
clone_stage4 || perror "Cloning stage4 failed with: $?"
elif [ "x$ACTION" == "xPACKAGE" ]; then