From 6818ee3e1df148392fcd1a81ab930efc48ca34c8 Mon Sep 17 00:00:00 2001 From: ahoemann Date: Tue, 8 Oct 2024 12:56:46 +0200 Subject: [PATCH] add: value sourcing --- .env | 4 ++++ shemum | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..a7a1a57 --- /dev/null +++ b/.env @@ -0,0 +1,4 @@ +# Virtual machine settings +RAM="512M" +CPU="1" +DISK_SIZE="8G" diff --git a/shemum b/shemum index b2aa8b5..e2942b1 100755 --- a/shemum +++ b/shemum @@ -15,21 +15,20 @@ # Default: ON #:exec 1> >(logger -s -t $(basename $0)) 2>&1 -# Virtual machine settings -RAM="512M" -CPU="1" -DISK_SIZE="8G" - # Arguments OPTION=$1 OS_NAME=$2 -#DISK_SIZE=$3 # Defining paths ROOT_PATH="$HOME/Machines" ISO_PATH="$ROOT_PATH/$OS_NAME/$OS_NAME.iso" IMG_PATH="$ROOT_PATH/$OS_NAME/$OS_NAME.img" +# Sources defualt values +. ".env" + +# Sources virtual machine specific values +. "$ROOT_PATH/$OS_NAME/.env" # Defines install image repository. case $OS_NAME in @@ -78,11 +77,15 @@ case $OPTION in -drive file=$IMG_PATH,format=raw \ -m $RAM -smp $CPU ;; + "remove") + rm -r $ROOT_PATH/$OS_NAME + ;; *) echo "Usage: shemum [init] " - echo " init initialize a virtual machine" + echo " init initialize a virtual machine" echo " start start a QEMU virtual machine without console output" - echo " console start a QEMU virtual machine with console output" + echo " console start a QEMU virtual machine with console output" + echo " remove remove virtual machine directory and all it's contents" esac