fix: #12 - add 'templates' command line argument to set templates storage

This commit is contained in:
Elton Renda 2021-04-26 12:30:53 +02:00
parent 70038bf74a
commit 0dfcaf082a
2 changed files with 9 additions and 2 deletions

View File

@ -22,6 +22,7 @@ curl -sL https://raw.githubusercontent.com/ej52/proxmox/main/lxc/nginx-proxy-man
| --hostname | nginx-proxy-manager | hostname of the container |
| --memory | 512 | amount of memory |
| --storage | local-lvm | storage location for container disk |
| --templates | local | storage location for templates |
| --swap | 0 | amount of SWAP |
you can set these parameters by appending ` -- <parameter> <value>` like:

View File

@ -75,6 +75,10 @@ while [[ $# -gt 0 ]]; do
_storage=$2
shift
;;
--storage-template)
__storage_template=$2
shift
;;
--swap)
_swap=$2
shift
@ -95,6 +99,7 @@ _bridge=${_bridge:-vmbr0}
_memory=${_memory:-512}
_swap=${_swap:-0}
_storage=${_storage:-local-lvm}
_storage_template=${__storage_template:-local}
# Test if ID is in use
if pct status $_ctid &>/dev/null; then
@ -114,6 +119,7 @@ warn "swap: $_swap"
warn "disksize: $_disk_size"
warn "bridge: $_bridge"
warn "storage: $_storage"
warn "templates: $_storage_template"
warn ""
warn "If you want to abort, hit ctrl+c within 10 seconds..."
echo ""
@ -130,7 +136,7 @@ mapfile -t _templates < <(pveam available -section system | sed -n "s/.*\($_os_t
&& error "No LXC template found for $_os_type-$_os_version"
_template="${_templates[-1]}"
pveam download local $_template &>/dev/null \
pveam download $_storage_template $_template &>/dev/null \
|| error "A problem occured while downloading the LXC template."
# Create variables for container disk
@ -174,7 +180,7 @@ _pct_options=(
-swap $_swap
-tags npm
)
pct create $_ctid "local:vztmpl/$_template" ${_pct_options[@]} &>/dev/null \
pct create $_ctid "$_storage_template:vztmpl/$_template" ${_pct_options[@]} &>/dev/null \
|| error "A problem occured while creating LXC container."
# Set container timezone to match host