Functions #1
1 changed files with 20 additions and 16 deletions
36
shemum
36
shemum
|
@ -65,26 +65,30 @@ console_func function {
|
||||||
-m $RAM -smp $CPU
|
-m $RAM -smp $CPU
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init_func function {
|
||||||
|
mkdir -p "$ROOT_PATH/$OS_NAME"
|
||||||
|
qemu-img create $IMG_PATH $DISK_SIZE
|
||||||
|
if [ ! -f $ISO_PATH ] && [ ! -z $INSTALL_IMG ]; then
|
||||||
|
echo $INSTALL_IMG
|
||||||
|
curl -o $ISO_PATH $INSTALL_IMG
|
||||||
|
elif [ ! -z $INSTALL_IMG ]; then
|
||||||
|
echo "Current INSTALL_IMG for $OS_NAME: $ISO_PATH"
|
||||||
|
else:
|
||||||
|
echo "Install image path is missing" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
qemu-system-x86_64 -boot d \
|
||||||
|
-display curses \
|
||||||
|
-drive file=$ISO_PATH,media=cdrom \
|
||||||
|
-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.
|
||||||
"init")
|
"init")
|
||||||
mkdir -p "$ROOT_PATH/$OS_NAME"
|
init_func
|
||||||
qemu-img create $IMG_PATH $DISK_SIZE
|
|
||||||
if [ ! -f $ISO_PATH ] && [ ! -z $INSTALL_IMG ]; then
|
|
||||||
echo $INSTALL_IMG
|
|
||||||
curl -o $ISO_PATH $INSTALL_IMG
|
|
||||||
elif [ ! -z $INSTALL_IMG ]; then
|
|
||||||
echo "Current INSTALL_IMG for $OS_NAME: $ISO_PATH"
|
|
||||||
else:
|
|
||||||
echo "Install image path is missing" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
qemu-system-x86_64 -boot d \
|
|
||||||
-display curses \
|
|
||||||
-drive file=$ISO_PATH,media=cdrom \
|
|
||||||
-drive file=$IMG_PATH,format=raw \
|
|
||||||
-m $RAM -smp $CPU
|
|
||||||
;;
|
;;
|
||||||
"console")
|
"console")
|
||||||
console_func
|
console_func
|
||||||
|
|
Loading…
Reference in a new issue