add: value sourcing
This commit is contained in:
parent
4fd0f57777
commit
6818ee3e1d
2 changed files with 15 additions and 8 deletions
4
.env
Normal file
4
.env
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Virtual machine settings
|
||||||
|
RAM="512M"
|
||||||
|
CPU="1"
|
||||||
|
DISK_SIZE="8G"
|
15
shemum
15
shemum
|
@ -15,21 +15,20 @@
|
||||||
# Default: ON
|
# Default: ON
|
||||||
#:exec 1> >(logger -s -t $(basename $0)) 2>&1
|
#:exec 1> >(logger -s -t $(basename $0)) 2>&1
|
||||||
|
|
||||||
# Virtual machine settings
|
|
||||||
RAM="512M"
|
|
||||||
CPU="1"
|
|
||||||
DISK_SIZE="8G"
|
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
OPTION=$1
|
OPTION=$1
|
||||||
OS_NAME=$2
|
OS_NAME=$2
|
||||||
#DISK_SIZE=$3
|
|
||||||
|
|
||||||
# Defining paths
|
# Defining paths
|
||||||
ROOT_PATH="$HOME/Machines"
|
ROOT_PATH="$HOME/Machines"
|
||||||
ISO_PATH="$ROOT_PATH/$OS_NAME/$OS_NAME.iso"
|
ISO_PATH="$ROOT_PATH/$OS_NAME/$OS_NAME.iso"
|
||||||
IMG_PATH="$ROOT_PATH/$OS_NAME/$OS_NAME.img"
|
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.
|
# Defines install image repository.
|
||||||
case $OS_NAME in
|
case $OS_NAME in
|
||||||
|
@ -78,11 +77,15 @@ case $OPTION in
|
||||||
-drive file=$IMG_PATH,format=raw \
|
-drive file=$IMG_PATH,format=raw \
|
||||||
-m $RAM -smp $CPU
|
-m $RAM -smp $CPU
|
||||||
;;
|
;;
|
||||||
|
"remove")
|
||||||
|
rm -r $ROOT_PATH/$OS_NAME
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: shemum [init] <virtual machine name> <disk size>"
|
echo "Usage: shemum [init] <virtual machine name> <disk size>"
|
||||||
echo " init initialize a virtual machine"
|
echo " init initialize a virtual machine"
|
||||||
echo " start start a QEMU virtual machine without console output"
|
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
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue