Update vmcreate1.sh
This commit is contained in:
@@ -12,16 +12,18 @@ storage="syno-tigra"
|
||||
#path="/mnt/pve/$storage/snippets"
|
||||
path="./snippets"
|
||||
node=3
|
||||
size=50
|
||||
|
||||
show_help()
|
||||
echo 'Usage:'
|
||||
echo 'vmcreate [-h][-a rule_name][-k pub_keyfile][-u][-p][-f filename]'
|
||||
echo 'vmcreate [-h][-a rule_name][-k pub_keyfile][-u][-p][-d 50][-f filename]'
|
||||
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 "-p - specify password instead of default"
|
||||
echo "-d - add custom disk space (in gibibytes, integer). Default is 50."
|
||||
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`."
|
||||
@@ -37,10 +39,11 @@ while getopts "a:f:h" opt; do
|
||||
k) pubkey="$OPTARG";;
|
||||
u) username="$OPTARG";;
|
||||
p) password="$OPTARG";;
|
||||
d) size="$OPTARG"; ;;
|
||||
# *) noopts=true
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ size >= 10 && size <= 500 ]]; then echo "Disk size increment shoud be in range of 10..500. Aborting."
|
||||
# Вывод переменных для дебага:
|
||||
if [[ -v file ]]; then echo "File: $file"; fi
|
||||
if [[ -v pubkey ]]; then echo "Public key: $pubkey"; fi
|
||||
|
||||
Reference in New Issue
Block a user