add --list option
This commit is contained in:
parent
1db92cb3f0
commit
9a842720b7
1 changed files with 25 additions and 13 deletions
32
vm-start.sh
32
vm-start.sh
|
@ -4,7 +4,7 @@
|
||||||
#RESULT_POSSIBLE=("init","list","start","start_backup","create","backup","restore","suppr")
|
#RESULT_POSSIBLE=("init","list","start","start_backup","create","backup","restore","suppr")
|
||||||
|
|
||||||
# Constante d'éxecutions.
|
# Constante d'éxecutions.
|
||||||
Version="0.7.0-developpement_day"
|
Version="0.7.0-developpement_01-31-2021"
|
||||||
USAGE="vm-start [PARAMETTER] [ NAME COMMAND [OPTION] ]
|
USAGE="vm-start [PARAMETTER] [ NAME COMMAND [OPTION] ]
|
||||||
|
|
||||||
Script to manage virtual machine easily.
|
Script to manage virtual machine easily.
|
||||||
|
@ -14,7 +14,7 @@ NAME is the name of the virtual machine to use.
|
||||||
PARAMETTER available
|
PARAMETTER available
|
||||||
-h, --help Print this help and exit
|
-h, --help Print this help and exit
|
||||||
-v, --version Print the version of this program and quit
|
-v, --version Print the version of this program and quit
|
||||||
-l, --list Print the list of all availables machines and quit <TODO>
|
-l, --list Print the list of all availables machines and quit
|
||||||
|
|
||||||
COMMAND available
|
COMMAND available
|
||||||
init Create the conf file in conf/NAME_var.sh
|
init Create the conf file in conf/NAME_var.sh
|
||||||
|
@ -57,6 +57,13 @@ OPTION="-display gtk \
|
||||||
#-usbdevice tablet \
|
#-usbdevice tablet \
|
||||||
|
|
||||||
|
|
||||||
|
list() {
|
||||||
|
echo "this is the list of all vm actually configured."
|
||||||
|
for vm in $(ls conf); do
|
||||||
|
echo "${vm%-vm_var.sh}"
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
HELP() {
|
HELP() {
|
||||||
echo "$USAGE"
|
echo "$USAGE"
|
||||||
|
@ -185,17 +192,23 @@ set_uefi() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# gère les paramètres
|
# change active directory to became the one is stored vm-start. In case it is impossible, quit.
|
||||||
|
cd "$( dirname "$( readlink -f "$0" )" )" || exit
|
||||||
|
|
||||||
|
# gère les paramètres
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
if [ "$i" == "-h" ] || [ "$i" == "--help" ]
|
case "$i" in
|
||||||
then
|
"-h" | "--help")
|
||||||
HELP
|
HELP
|
||||||
elif [ "$i" == "-v" ] || [ "$i" == "--version" ]
|
;;
|
||||||
then
|
"-v" | "--version")
|
||||||
echo "vm-start ${Version}"
|
echo "vm-start ${Version}"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
;;
|
||||||
|
"-l" | "--list")
|
||||||
|
list
|
||||||
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
@ -210,9 +223,8 @@ fi
|
||||||
# vérifie que le dossier pour stocker les vms existe & change le dossier actif pour qu'il soit cellui du lanceur.
|
# vérifie que le dossier pour stocker les vms existe & change le dossier actif pour qu'il soit cellui du lanceur.
|
||||||
|
|
||||||
mkdir -p "$MAIN_LOCATION"
|
mkdir -p "$MAIN_LOCATION"
|
||||||
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érifie 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 [ ! -f "conf/$1-vm_var.sh" ]
|
if [ ! -f "conf/$1-vm_var.sh" ]
|
||||||
|
|
Loading…
Reference in a new issue