add --list option
This commit is contained in:
parent
1db92cb3f0
commit
9a842720b7
1 changed files with 25 additions and 13 deletions
38
vm-start.sh
38
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_day"
|
||||
Version="0.7.0-developpement_01-31-2021"
|
||||
USAGE="vm-start [PARAMETTER] [ NAME COMMAND [OPTION] ]
|
||||
|
||||
Script to manage virtual machine easily.
|
||||
|
@ -14,7 +14,7 @@ NAME is the name of the virtual machine to use.
|
|||
PARAMETTER available
|
||||
-h, --help Print this help and exit
|
||||
-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
|
||||
init Create the conf file in conf/NAME_var.sh
|
||||
|
@ -57,6 +57,13 @@ OPTION="-display gtk \
|
|||
#-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() {
|
||||
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
|
||||
if [ "$i" == "-h" ] || [ "$i" == "--help" ]
|
||||
then
|
||||
HELP
|
||||
elif [ "$i" == "-v" ] || [ "$i" == "--version" ]
|
||||
then
|
||||
echo "vm-start ${Version}"
|
||||
exit 0
|
||||
fi
|
||||
case "$i" in
|
||||
"-h" | "--help")
|
||||
HELP
|
||||
;;
|
||||
"-v" | "--version")
|
||||
echo "vm-start ${Version}"
|
||||
exit 0
|
||||
;;
|
||||
"-l" | "--list")
|
||||
list
|
||||
;;
|
||||
esac
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
if [ ! -f "conf/$1-vm_var.sh" ]
|
||||
|
|
Loading…
Reference in a new issue