Functions #1
1 changed files with 14 additions and 8 deletions
22
shemum
22
shemum
|
@ -45,17 +45,26 @@ esac
|
||||||
# Functions
|
# Functions
|
||||||
|
|
||||||
# Virtual machine removal
|
# Virtual machine removal
|
||||||
remove function {
|
remove_func function {
|
||||||
rm -r $ROOT_PATH/$OS_NAME
|
rm -r $ROOT_PATH/$OS_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
start function {
|
# Virtual machine start without a console
|
||||||
|
start_func function {
|
||||||
qemu-system-x86_64 -boot c \
|
qemu-system-x86_64 -boot c \
|
||||||
-display none \
|
-display none \
|
||||||
-drive file=$IMG_PATH,format=raw \
|
-drive file=$IMG_PATH,format=raw \
|
||||||
-m $RAM -smp $CPU
|
-m $RAM -smp $CPU
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Virtual machine start with a console
|
||||||
|
console_func function {
|
||||||
|
qemu-system-x86_64 -boot c \
|
||||||
|
-display curses \
|
||||||
|
-drive file=$IMG_PATH,format=raw \
|
||||||
|
-m $RAM -smp $CPU
|
||||||
|
}
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
case $OPTION in
|
case $OPTION in
|
||||||
# Initializes the VM and starts the installer image.
|
# Initializes the VM and starts the installer image.
|
||||||
|
@ -78,16 +87,13 @@ case $OPTION in
|
||||||
-m $RAM -smp $CPU
|
-m $RAM -smp $CPU
|
||||||
;;
|
;;
|
||||||
"console")
|
"console")
|
||||||
qemu-system-x86_64 -boot c \
|
console_func
|
||||||
-display curses \
|
|
||||||
-drive file=$IMG_PATH,format=raw \
|
|
||||||
-m $RAM -smp $CPU
|
|
||||||
;;
|
;;
|
||||||
"start")
|
"start")
|
||||||
start
|
start_func
|
||||||
;;
|
;;
|
||||||
"remove")
|
"remove")
|
||||||
remove
|
remove_func
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: shemum [init] <virtual machine name> <disk size>"
|
echo "Usage: shemum [init] <virtual machine name> <disk size>"
|
||||||
|
|
Loading…
Reference in a new issue