From c7717eda0ef2e4a816c8027e4157f68179f6811d Mon Sep 17 00:00:00 2001 From: tteckster Date: Tue, 29 Mar 2022 08:52:20 -0400 Subject: [PATCH] Create pimox-haos.sh --- vm/pimox-haos.sh | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 vm/pimox-haos.sh diff --git a/vm/pimox-haos.sh b/vm/pimox-haos.sh new file mode 100644 index 00000000..66be6f55 --- /dev/null +++ b/vm/pimox-haos.sh @@ -0,0 +1,69 @@ +#!/bin/bash +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +function error_exit() { + REASON=$1 + MSG="\e[91mERROR: \e[93m$EXIT@" + if [ -z "$REASON" ]; then + MSG="$MSG$LINE:" + REASON="Unknown failure occured." + else + MSG="$MSG`echo $(( $LINE - 1 ))`:" + fi + echo -e "$MSG \e[97m$REASON\e[39m\e[49m" + exit $EXIT +} +function cleanup() { + popd >/dev/null + rm -rf $TMP +} +trap cleanup EXIT +TMP=`mktemp -d` +pushd $TMP >/dev/null + +VMID=$(cat<&/dev/null && \ +qm importdisk $VMID ${FILE%".xz"} local 1>&/dev/null +echo -e "Completed Successfully, New VM ID is $VMID \n"