added actual template path...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2024-01-05 02:26:45 +03:00
parent a60d455dbb
commit 38f0a966fd

View File

@ -144,13 +144,17 @@ normpath(){
# #
# getLatestTemplate PATTERN [VAR] # getLatestTemplate PATTERN [VAR]
# #
# see:
# https://pve.proxmox.com/wiki/Linux_Container
getLatestTemplate(){ getLatestTemplate(){
IFS=$'\n' IFS=$'\n'
local pattern=$1 local pattern=$1
local templates=($(pveam available | grep -o ''${1}'.*$')) local templates=($(pveam available | grep -o ''${1}'.*$'))
local latest=${templates[-1]} local latest=${templates[-1]}
pveam download local ${latest} @ pveam download local ${latest}
latest=$(pveam list local | grep -o "^.*$latest")
[ -z $2 ] \ [ -z $2 ] \
|| eval "$2=${latest}" || eval "$2=${latest}"
@ -320,11 +324,8 @@ pctCreate(){
# pctCreate ID ARGS [PASS] # pctCreate ID ARGS [PASS]
# #
pctCreateAlpine(){ pctCreateAlpine(){
if [ $DRY_RUN ] ; then local TEMPLATE
local TEMPLATE=(/var/lib/vz/template/cache/alpine-3.18\*.tar.xz) getLatestTemplate alpine TEMPLATE
else
local TEMPLATE=($(ls /var/lib/vz/template/cache/alpine-3.18*.tar.xz))
fi
pctCreate $1 "${TEMPLATE[-1]}" "$2" "$3" pctCreate $1 "${TEMPLATE[-1]}" "$2" "$3"