correct drives bug with uefi mode
This commit is contained in:
parent
177b5cec3e
commit
f4177bdbd4
1 changed files with 41 additions and 28 deletions
35
vm-start.sh
35
vm-start.sh
|
@ -35,6 +35,7 @@ OPTION available
|
||||||
can be either set or unset. By default is unset.
|
can be either set or unset. By default is unset.
|
||||||
options=<option> additinal options to give to qemu. By default is
|
options=<option> additinal options to give to qemu. By default is
|
||||||
-display gtk -vga qxl
|
-display gtk -vga qxl
|
||||||
|
create_disk=<loc_disk> Def a create disk to boot on. Is necessary for using create, or need the variable INSTALLATION_DISK_LOCATION to be set.
|
||||||
"
|
"
|
||||||
MAIN_LOCATION="$HOME/virtual_machine"
|
MAIN_LOCATION="$HOME/virtual_machine"
|
||||||
OPTION="-display gtk \
|
OPTION="-display gtk \
|
||||||
|
@ -89,7 +90,7 @@ start_the_vm() {
|
||||||
-net nic \
|
-net nic \
|
||||||
-net user"$FORWARD",hostname="$VMHOSTNAME" \
|
-net user"$FORWARD",hostname="$VMHOSTNAME" \
|
||||||
-m "$MEMORY" \
|
-m "$MEMORY" \
|
||||||
-drive file="${MAIN_LOCATION}/${LOCATION}/${VMDRIVE}" \
|
-drive file="${MAIN_LOCATION}/${LOCATION}/${VMDRIVE}",index=2,id=maindrive,media=disk \
|
||||||
$OPTION
|
$OPTION
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -132,7 +133,8 @@ CREATE() {
|
||||||
|
|
||||||
OPTION="$OPTION \
|
OPTION="$OPTION \
|
||||||
-boot d \
|
-boot d \
|
||||||
-drive file=$1,media=cdrom"
|
-drive file=$1,if=none,media=cdrom,id=drive-cd1 \
|
||||||
|
-device ide-cd,drive=drive-cd1,id=cd1,bootindex=1"
|
||||||
|
|
||||||
start_the_vm
|
start_the_vm
|
||||||
|
|
||||||
|
@ -208,13 +210,16 @@ cd "$( dirname "$( readlink -f "$0" )" )" || exit
|
||||||
# Véréfie qu'il y ait bien un fichier de config pour la vm que l'on tente de démarer dans la cas contraire en génére un.
|
# Véréfie qu'il y ait bien un fichier de config pour la vm que l'on tente de démarer dans la cas contraire en génére un.
|
||||||
# possibilitée de générer à nouveau le fichier de config avec vm-start nom-vm init
|
# possibilitée de générer à nouveau le fichier de config avec vm-start nom-vm init
|
||||||
|
|
||||||
if [ "$2" == "init" ]
|
if [ ! -f "conf/$1-vm_var.sh" ]
|
||||||
then
|
|
||||||
INIT "$1"
|
|
||||||
elif [ ! -f "conf/$1-vm_var.sh" ]
|
|
||||||
then
|
then
|
||||||
echo "no config file found. creating one in conf/${1}-vm_var.sh"
|
echo "no config file found. creating one in conf/${1}-vm_var.sh"
|
||||||
INIT "$1"
|
INIT "$1"
|
||||||
|
|
||||||
|
if [ "$2" == "init" ]
|
||||||
|
then
|
||||||
|
# Exit, it is the end of the program.
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Vérifie si l'option UEFI est set dans le fichier de config. Si oui l'ajoutte aux options.
|
#Vérifie si l'option UEFI est set dans le fichier de config. Si oui l'ajoutte aux options.
|
||||||
|
@ -232,6 +237,11 @@ for (( i=3; i<=$#; i++)); do
|
||||||
"uefi")
|
"uefi")
|
||||||
set_uefi
|
set_uefi
|
||||||
;;
|
;;
|
||||||
|
"create_disk")
|
||||||
|
INSTALLATION_DISK_LOCATION="${!i#*=}"
|
||||||
|
echo "${!i#*=}"
|
||||||
|
echo "${INSTALLATION_DISK_LOCATION}"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -261,12 +271,11 @@ case "$2" in
|
||||||
;;
|
;;
|
||||||
"create")
|
"create")
|
||||||
echo "creating VM"
|
echo "creating VM"
|
||||||
if [ $# -ge 3 ]
|
if [ ! "${INSTALLATION_DISK_LOCATION}" == "" ]
|
||||||
then
|
then
|
||||||
echo "using image disk $3"
|
echo "using image disk ${INSTALLATION_DISK_LOCATION}"
|
||||||
CREATE "$3"
|
CREATE "${INSTALLATION_DISK_LOCATION}"
|
||||||
else
|
else
|
||||||
echo "$#"
|
|
||||||
echo "Error, no image defined." >&2
|
echo "Error, no image defined." >&2
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
@ -274,7 +283,11 @@ case "$2" in
|
||||||
echo "suppressing all data of the vm $1"
|
echo "suppressing all data of the vm $1"
|
||||||
SUPPRESS "$1"
|
SUPPRESS "$1"
|
||||||
;;
|
;;
|
||||||
"*")
|
"init")
|
||||||
|
echo "Init volume $1"
|
||||||
|
INIT "$1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
echo "commande $2 inconnue" >&2
|
echo "commande $2 inconnue" >&2
|
||||||
HELP
|
HELP
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue