From bab920dbc31e8408011bd6b24c3fc0b1db6433b0 Mon Sep 17 00:00:00 2001 From: Dmitry Badovsky Date: Sat, 25 Oct 2025 14:44:53 +0000 Subject: [PATCH] Update vmcreate1.sh --- vmcreate1.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/vmcreate1.sh b/vmcreate1.sh index ea49655..36d44fe 100644 --- a/vmcreate1.sh +++ b/vmcreate1.sh @@ -4,6 +4,7 @@ # Сделать добавление кастомного полльзователя с паролем # Сделать замену тега влан # Сделать проверку наличия ВМ перед клонированием. Если создать ВМ не удалось, скипаем, а не выходим. +# ИЗУЧИТЬ!!!! /usr/share/pve-docs/examples/guest-example-hookscript.pl storage="syno-tigra" path="/mnt/pve/$storage/snippets" @@ -16,12 +17,12 @@ show_help() echo 'Arguments:' echo '-h - show this help;' echo '-a - add hosts to HA affinity rules;' - echo "-k - embed custom public key or create new if 'pub_keyfile' not specified" - echo "-u - specify user instead of default 'root'" + echo "-k - embed custom public key or create new if `pub_keyfile` not specified" + echo "-u - specify user instead of default `root`" echo "-p - UNDER CONSTRUCTION!!!!!! specify password instead of default" - echo "-f - get IP addresses and Hostnames from 'flilename';" + echo "-f - get IP addresses and Hostnames from `flilename`;" echo "\nIf file not specified, script will use arguments as a list of IP addresses." - echo "In this case Hostname will be inherited from 2 last IP octets. Example for 10.10.35.20: 'vm035020'." + echo "In this case Hostname will be inherited from 2 last IP octets. Example for 10.10.35.20: `vm035020`." echo "IP address should be 10.10.*.*" @@ -41,7 +42,7 @@ done # Если файл не задан, но флаг есть if [[ $# -eq 0 && -v $file && ! -f $file ]]; then input=y - read -p "File $file does not exist. Use default 'hosts' file? Y/n: " input + read -p "File `$file` does not exist. Use default `hosts` file? Y/n: " input case $input in y) file=hosts;; Y) file=hosts;; @@ -49,7 +50,7 @@ if [[ $# -eq 0 && -v $file && ! -f $file ]]; then N) read -p "Enter file name: " file;; *) echo "Use '-f' flag for help"; exit 0;; esac - if [ ! -f hosts ]; then echo "File 'hosts' does not exist. Exiting."; exit 0; fi + if [ ! -f hosts ]; then echo "File `hosts` does not exist. Exiting."; exit 0; fi fi # Если заданы аргументы И файл @@ -93,7 +94,7 @@ if [ $# -ne 0 ] then printf "%03d\n" "$(echo -n $arg | cut -d '.' -f 4)" >> ./hosts.tmp echo >> ./hosts.tmp else - echo "Argument $arg is not a valid IPv4 address (10.10.*.*). Using next argument." + echo "Argument `$arg` is not a valid IPv4 address (10.10.*.*). Using next argument." fi done fi @@ -139,7 +140,7 @@ if [ -v pubkey ]; then fi else pubkey="key.pub" - if [[ ! -e key.pub ]]; then echo "'key.pub' does not exist. Please use '-k' flag to specify public key."; exit 0; fi + if [[ ! -e key.pub ]]; then echo "`key.pub` does not exist. Please use `-k` flag to specify public key."; exit 0; fi fi keypair_generate (){ @@ -189,7 +190,6 @@ do qm set $vmnum --ipconfig0 ip=$ip/24,gw=10.10.35.1 qm cloudinit update $vmnum qm start $vmnum - echo "VMs from $1 successfully created" if [ -v harule ] then ha-manager add vm:$vmnum --state started --max_relocate 2 @@ -203,6 +203,6 @@ done rm hosts.tmp if [ -v $privkey ] then - echo "\nGenerated private key $privkey" + echo "\nGenerated private key `$privkey`" echo "SAVE IT IMMEDIATELY!!!" fi \ No newline at end of file