From 67b12d12f658f5b3fecd89775fa4d120614c819a Mon Sep 17 00:00:00 2001 From: Julien Escario Date: Fri, 18 Jun 2021 14:41:46 +0200 Subject: [PATCH] Verify args --- cloud-init/create_ubuntu20_template.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cloud-init/create_ubuntu20_template.sh b/cloud-init/create_ubuntu20_template.sh index 2fc3f29..ff154b1 100644 --- a/cloud-init/create_ubuntu20_template.sh +++ b/cloud-init/create_ubuntu20_template.sh @@ -1,6 +1,15 @@ #!/bin/sh -_storage=${1} +_usage() { + echo " + Usage: $0 + : 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 if [ "$?" -ne "0" ]; then echo "Storage $_storage does not seems to exists. Use 'pvesm status' to find a usable storage"