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 "Proxmox Debian Template Creator"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Required values
|
# Required arguments
|
||||||
|
|
||||||
if test -z "$vmid"
|
if test -z "$vmid"
|
||||||
read -l -P "Template ID: " vmid
|
read -P "Template ID: " vmid
|
||||||
end
|
|
||||||
|
|
||||||
if test -z "$vmid"
|
if test -z "$vmid"
|
||||||
echo "Error: Template ID is required."
|
echo "Error: Template ID is required."
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if test -z "$name"
|
if test -z "$name"
|
||||||
echo "Example: debian13tmpl"
|
echo "Example: debian13tmpl"
|
||||||
read -l -P "Template Name: " name
|
read -P "Template Name: " name
|
||||||
end
|
|
||||||
|
|
||||||
if test -z "$name"
|
if test -z "$name"
|
||||||
echo "Error: Template name is required."
|
echo "Error: Template name is required."
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Optional values with configured defaults
|
# Optional arguments
|
||||||
|
|
||||||
test -n "$bridge"; or set bridge $VM_TEMPLATE_BRIDGE
|
test -n "$bridge"; or set bridge $VM_TEMPLATE_BRIDGE
|
||||||
test -n "$image"; or set image $VM_TEMPLATE_IMAGE
|
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
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
# Prompt for bridge if it wasn't supplied
|
# Allow bridge override interactively
|
||||||
|
|
||||||
if test -z "$argv[3]"
|
if test -z "$argv[3]"
|
||||||
set -l options (string join "/" $VM_TEMPLATE_BRIDGES)
|
set -l options (string join "/" $VM_TEMPLATE_BRIDGES)
|
||||||
read -l -P "Bridge [$options]: " tmp
|
|
||||||
|
read -P "Bridge [$options]: " tmp
|
||||||
|
|
||||||
if test -n "$tmp"
|
if test -n "$tmp"
|
||||||
set bridge $tmp
|
set bridge $tmp
|
||||||
@ -75,15 +76,15 @@ function create_template --description "Create a Debian cloud-init template"
|
|||||||
echo "Storage: $storage"
|
echo "Storage: $storage"
|
||||||
echo
|
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."
|
echo "Aborted."
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
qm create $vmid \
|
qm create $vmid \
|
||||||
--name $name \
|
--name "$name" \
|
||||||
--ostype l26 \
|
--ostype l26 \
|
||||||
--machine q35 \
|
--machine q35 \
|
||||||
--cpu host \
|
--cpu host \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user