From 02895331e3062f982f4da499ed3eedc7a79d9186 Mon Sep 17 00:00:00 2001 From: whiskerz007 <2713522+whiskerz007@users.noreply.github.com> Date: Fri, 20 Mar 2020 14:39:06 +0100 Subject: [PATCH] Add info function and improve script output --- install.sh | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/install.sh b/install.sh index c0894f3..666a70e 100644 --- a/install.sh +++ b/install.sh @@ -18,6 +18,11 @@ function error_exit() { msg "$FLAG $REASON" exit $EXIT } +function info() { + local REASON="$1" + local FLAG="\e[36m[INFO]\e[39m" + msg "$FLAG $REASON" +} function msg() { local TEXT="$1" echo -e "$TEXT" @@ -36,6 +41,7 @@ pvesm list $STORAGE >& /dev/null || pvesm status -content images -storage $STORAGE >&/dev/null || die "'$STORAGE' does not allow 'Disk image' to be stored." STORAGE_TYPE=`pvesm status -storage $STORAGE | awk 'NR>1 {print $2}'` +info "Using '$STORAGE' for storage location." # Get the next guest VM/LXC ID VMID=$(cat<&/dev/null @@ -110,8 +106,4 @@ qm importdisk $VMID ${FILE%".gz"} $STORAGE ${IMPORT_OPT:-} 1>&/dev/null qm set $VMID -bootdisk sata0 -efidisk0 ${DISK0_REF},size=128K \ -sata0 ${DISK1_REF},size=6G > /dev/null -msg "\n\n\n - ******************************** - * Completed Successfully * - * New VM ID is \e[1m$VMID\e[0m * - ********************************" +info "Completed Successfully! New VM ID is \e[1m$VMID\e[0m."