add suppr_all
This commit is contained in:
parent
c8223843f6
commit
fe85b61298
1 changed files with 25 additions and 9 deletions
34
vm-start.sh
34
vm-start.sh
|
@ -4,7 +4,7 @@
|
|||
#RESULT_POSSIBLE=("init","list","start","start_backup","create","backup","restore","suppr")
|
||||
|
||||
# Constante d'éxecutions.
|
||||
Version="0.7.0-developpement_01-31-2021"
|
||||
Version="0.7.0-developpement_02-01-2021"
|
||||
USAGE="vm-start [PARAMETTER] [ NAME COMMAND [OPTION] ]
|
||||
|
||||
Script to manage virtual machine easily.
|
||||
|
@ -24,14 +24,13 @@ COMMAND available
|
|||
backup Create a backup file for the vm
|
||||
restore Restore the virtual machine using to backup file
|
||||
suppr Suppr all data related to the virtual machine other than the conf file.
|
||||
suppr-all Suppr all data related to the vm even the conf file
|
||||
|
||||
COMMAND TODO
|
||||
suppr-all Suppr all data related to the vm even the conf file #TODO
|
||||
|
||||
OPTION available
|
||||
nproc=<nb proc> Def the number of proc of the vm
|
||||
memory=<mem> Def the qty of memory allocated to the vm
|
||||
size=<size> Def the size that should be allocated by create
|
||||
size=<size> Def the size that should be allocated by create #TODO
|
||||
uefi Select if there will be an UEFI by default.
|
||||
can be either set or unset. By default is unset.
|
||||
options=<option> additinal options to give to qemu. By default is
|
||||
|
@ -78,12 +77,15 @@ INIT() {
|
|||
NAME="$1"
|
||||
read -p "How many proccessor will you use ? " -r NPROC
|
||||
read -p "How much memory will you need ? " -r MEMORY
|
||||
read -p "Do you want to forward ssh port (y/n) " -r entry
|
||||
|
||||
if echo "$entry" | grep -q "^[yY]$"
|
||||
then
|
||||
FORWARD=",hostfwd=tcp::10022-:22" # forward VM 22 port to Host 10022
|
||||
fi
|
||||
# from now on, ssh port forward to choose while exec the script.
|
||||
|
||||
#read -p "Do you want to forward ssh port (y/n) " -r entry
|
||||
|
||||
#if echo "$entry" | grep -q "^[yY]$"
|
||||
#then
|
||||
# FORWARD=",hostfwd=tcp::10022-:22" # forward VM 22 port to Host 10022
|
||||
#fi
|
||||
|
||||
mkdir -p conf
|
||||
cat << EOF > "conf/$NAME-vm_var.sh"
|
||||
|
@ -192,6 +194,16 @@ SUPPRESS() {
|
|||
fi
|
||||
}
|
||||
|
||||
|
||||
suppress_all() {
|
||||
read -p "Are you sure you want to delete all data relative to the vm $1 even conf file? (y/N)" -r entry
|
||||
if echo "$entry" | grep -q "^[yY]$"
|
||||
then
|
||||
rm -i conf/$1-vm_var.sh
|
||||
rm -Ri "${MAIN_LOCATION}/${LOCATION}"
|
||||
fi
|
||||
}
|
||||
|
||||
set_uefi() {
|
||||
UEFI="set"
|
||||
OPTION="${OPTION} \
|
||||
|
@ -342,6 +354,10 @@ case "$2" in
|
|||
echo "suppressing all data of the vm $1"
|
||||
SUPPRESS "$1"
|
||||
;;
|
||||
"suppr-all")
|
||||
echo "suppressing all data and conf file of the vm $1"
|
||||
suppress_all "$1"
|
||||
;;
|
||||
"init")
|
||||
echo "Init volume $1"
|
||||
INIT "$1"
|
||||
|
|
Loading…
Reference in a new issue