diff --git a/vmcreate1.sh b/vmcreate1.sh index 2c0e305..486732b 100644 --- a/vmcreate1.sh +++ b/vmcreate1.sh @@ -19,14 +19,14 @@ 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 - specify password instead of default" echo "-d - add custom disk space (in gibibytes, integer). Default is 50." echo "-t - add additional proxmox tag. Default is only pve node number." - 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 +41,7 @@ while getopts "a:f:h" opt; do p) password="$OPTARG";; d) size="$OPTARG";; t) tag="$OPTARG";; - *) echo "Invalid option. Use `-h` for help."; exit 1;; + *) echo "Invalid option. Use '-h' for help."; exit 1;; esac done @@ -56,16 +56,16 @@ if [[ -v username ]]; then echo "User: $file"; fi # Если файл не задан, но флаг есть if [[ $# -eq 0 && -v "$file" && ! -e "$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;; n) read -p "Enter file name: " file;; N) read -p "Enter file name: " file;; - *) echo "Use `-h` flag for help"; exit 0;; + *) echo "Use '-h' flag for help"; exit 0;; esac if [[ ! -e "$file" ]]; then - echo "File `$file` does not exist. Exiting." + echo "File $file does not exist. Exiting." exit 1 fi fi @@ -88,12 +88,12 @@ if [[ -e "$file" ]]; then if [[ $? -eq 0 ]]; then echo $line >> hosts.tmp else - echo "Hostname `$hostname` is not valid. Should contain only letters, numbers and dash. Aborting." + echo "Hostname $hostname is not valid. Should contain only letters, numbers and dash. Aborting." rm hosts.tmp exit 3 fi else - echo "`$ip` is not a valid IPv4 address (10.10.*.*). Aborting." + echo "$ip is not a valid IPv4 address (10.10.*.*). Aborting." rm hosts.tmp exit 4 fi @@ -112,7 +112,7 @@ if [[ $# -ne 0 ]]; then get_vmid "$arg" >> hosts.tmp echo >> hosts.tmp else - echo "Argument `$arg` is not a valid IPv4 address (10.10.*.*). Aborting." + echo "Argument $arg is not a valid IPv4 address (10.10.*.*). Aborting." rm hosts.tmp exit 5 fi @@ -178,11 +178,11 @@ 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 7; fi + if [[ ! -e key.pub ]]; then echo "key.pub does not exist. Please use '-k' flag to specify public key."; exit 7; fi fi ###DEBUG 1 -echo "File `hosts.tmp`:" +echo "File hosts.tmp:" cat hosts.tmp; echo ### @@ -256,6 +256,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