Fix: create_template
This commit is contained in:
parent
2c8c63bbc4
commit
fb0193e0f0
@ -14,28 +14,28 @@ function create_template --description "Create a Debian cloud-init template"
|
||||
echo "Proxmox Debian Template Creator"
|
||||
echo
|
||||
|
||||
# Required values
|
||||
# Required arguments
|
||||
|
||||
if test -z "$vmid"
|
||||
read -l -P "Template ID: " vmid
|
||||
end
|
||||
read -P "Template ID: " vmid
|
||||
|
||||
if test -z "$vmid"
|
||||
echo "Error: Template ID is required."
|
||||
return 1
|
||||
if test -z "$vmid"
|
||||
echo "Error: Template ID is required."
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
if test -z "$name"
|
||||
echo "Example: debian13tmpl"
|
||||
read -l -P "Template Name: " name
|
||||
read -P "Template Name: " name
|
||||
|
||||
if test -z "$name"
|
||||
echo "Error: Template name is required."
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
if test -z "$name"
|
||||
echo "Error: Template name is required."
|
||||
return 1
|
||||
end
|
||||
|
||||
# Optional values with configured defaults
|
||||
# Optional arguments
|
||||
|
||||
test -n "$bridge"; or set bridge $VM_TEMPLATE_BRIDGE
|
||||
test -n "$image"; or set image $VM_TEMPLATE_IMAGE
|
||||
@ -56,11 +56,12 @@ function create_template --description "Create a Debian cloud-init template"
|
||||
return 1
|
||||
end
|
||||
|
||||
# Prompt for bridge if it wasn't supplied
|
||||
# Allow bridge override interactively
|
||||
|
||||
if test -z "$argv[3]"
|
||||
set -l options (string join "/" $VM_TEMPLATE_BRIDGES)
|
||||
read -l -P "Bridge [$options]: " tmp
|
||||
|
||||
read -P "Bridge [$options]: " tmp
|
||||
|
||||
if test -n "$tmp"
|
||||
set bridge $tmp
|
||||
@ -75,15 +76,15 @@ function create_template --description "Create a Debian cloud-init template"
|
||||
echo "Storage: $storage"
|
||||
echo
|
||||
|
||||
read -l -P "Continue? [y/N]: " confirm
|
||||
read -P "Continue? [y/N]: " confirm
|
||||
|
||||
if test "$confirm" != y
|
||||
if test (string lower -- "$confirm") != y
|
||||
echo "Aborted."
|
||||
return 1
|
||||
end
|
||||
|
||||
qm create $vmid \
|
||||
--name $name \
|
||||
--name "$name" \
|
||||
--ostype l26 \
|
||||
--machine q35 \
|
||||
--cpu host \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user