Browse Source

Verify args

pull/1/head
Julien Escario 4 years ago
parent
commit
67b12d12f6
  1. 11
      cloud-init/create_ubuntu20_template.sh

11
cloud-init/create_ubuntu20_template.sh

@ -1,6 +1,15 @@
#!/bin/sh #!/bin/sh
_storage=${1}
_usage() {
echo "
Usage: $0 <storage>
<storage> : should be a valid (active, supporting VM image) PVE storage
"
}
[ -z "$1" ] && _usage && return
_storage=$1
pvesm status --enabled --target localhost --content images |awk {'print $1'} |tail +2 |grep "$_storage" > /dev/null 2>&1 pvesm status --enabled --target localhost --content images |awk {'print $1'} |tail +2 |grep "$_storage" > /dev/null 2>&1
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
echo "Storage $_storage does not seems to exists. Use 'pvesm status' to find a usable storage" echo "Storage $_storage does not seems to exists. Use 'pvesm status' to find a usable storage"

Loading…
Cancel
Save