Update create_lxc.sh
This commit is contained in:
parent
9f6bce8427
commit
7dca60f0f5
@ -274,8 +274,11 @@ fi
|
|||||||
TEMPLATE="${TEMPLATES[-1]}"
|
TEMPLATE="${TEMPLATES[-1]}"
|
||||||
|
|
||||||
function ensure_template_ready() {
|
function ensure_template_ready() {
|
||||||
|
echo "[DEBUG] ensure_template_ready() gestartet"
|
||||||
|
|
||||||
local template_path
|
local template_path
|
||||||
template_path="$(pvesm path $TEMPLATE_STORAGE:vztmpl/$TEMPLATE 2>/dev/null || echo "/var/lib/vz/template/cache/$TEMPLATE")"
|
template_path="$(pvesm path $TEMPLATE_STORAGE:vztmpl/$TEMPLATE 2>/dev/null || echo "/var/lib/vz/template/cache/$TEMPLATE")"
|
||||||
|
echo "[DEBUG] template_path=$template_path"
|
||||||
|
|
||||||
if ! pveam list "$TEMPLATE_STORAGE" | grep -q "$TEMPLATE"; then
|
if ! pveam list "$TEMPLATE_STORAGE" | grep -q "$TEMPLATE"; then
|
||||||
msg_warn "Template $TEMPLATE not listed in storage '$TEMPLATE_STORAGE'."
|
msg_warn "Template $TEMPLATE not listed in storage '$TEMPLATE_STORAGE'."
|
||||||
@ -287,11 +290,22 @@ function ensure_template_ready() {
|
|||||||
template_invalid=0
|
template_invalid=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "[DEBUG] template_invalid=$template_invalid"
|
||||||
|
|
||||||
if [ "$template_invalid" -eq 1 ]; then
|
if [ "$template_invalid" -eq 1 ]; then
|
||||||
[[ -f "$template_path" ]] && rm -f "$template_path"
|
[[ -f "$template_path" ]] && {
|
||||||
|
echo "[DEBUG] removing template_path $template_path"
|
||||||
|
rm -f "$template_path"
|
||||||
|
}
|
||||||
|
|
||||||
msg_info "Downloading LXC template..."
|
msg_info "Downloading LXC template..."
|
||||||
if timeout 120 pveam download "$TEMPLATE_STORAGE" "$TEMPLATE" >/dev/null 2>&1; then
|
echo "[DEBUG] calling pveam download"
|
||||||
|
sleep 0.2
|
||||||
|
timeout 120 pveam download "$TEMPLATE_STORAGE" "$TEMPLATE" >/dev/null 2>&1
|
||||||
|
dl_result=$?
|
||||||
|
echo "[DEBUG] pveam download exit=$dl_result"
|
||||||
|
|
||||||
|
if [ $dl_result -eq 0 ]; then
|
||||||
msg_ok "Template download successful."
|
msg_ok "Template download successful."
|
||||||
else
|
else
|
||||||
msg_error "Template download failed. Check internet or run manually:\n pveam download $TEMPLATE_STORAGE $TEMPLATE"
|
msg_error "Template download failed. Check internet or run manually:\n pveam download $TEMPLATE_STORAGE $TEMPLATE"
|
||||||
@ -299,6 +313,7 @@ function ensure_template_ready() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "[DEBUG] ensure_template_ready() abgeschlossen"
|
||||||
msg_ok "LXC Template '$TEMPLATE' is ready to use."
|
msg_ok "LXC Template '$TEMPLATE' is ready to use."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user