From 38f0a966fd0f2a2147dad73190c43ba65a81d1b6 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 5 Jan 2024 02:26:45 +0300 Subject: [PATCH] added actual template path... Signed-off-by: Alex A. Naanou --- .pct-helpers | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.pct-helpers b/.pct-helpers index 64b34c4..f763b13 100644 --- a/.pct-helpers +++ b/.pct-helpers @@ -144,13 +144,17 @@ normpath(){ # # getLatestTemplate PATTERN [VAR] # +# see: +# https://pve.proxmox.com/wiki/Linux_Container getLatestTemplate(){ IFS=$'\n' local pattern=$1 local templates=($(pveam available | grep -o ''${1}'.*$')) local latest=${templates[-1]} - pveam download local ${latest} + @ pveam download local ${latest} + + latest=$(pveam list local | grep -o "^.*$latest") [ -z $2 ] \ || eval "$2=${latest}" @@ -320,11 +324,8 @@ pctCreate(){ # pctCreate ID ARGS [PASS] # pctCreateAlpine(){ - if [ $DRY_RUN ] ; then - local TEMPLATE=(/var/lib/vz/template/cache/alpine-3.18\*.tar.xz) - else - local TEMPLATE=($(ls /var/lib/vz/template/cache/alpine-3.18*.tar.xz)) - fi + local TEMPLATE + getLatestTemplate alpine TEMPLATE pctCreate $1 "${TEMPLATE[-1]}" "$2" "$3"