Update create_lxc.sh
This commit is contained in:
parent
6ccb62d19e
commit
37748f3f47
@ -293,19 +293,14 @@ function ensure_template_ready() {
|
|||||||
if [ "$template_invalid" -eq 1 ]; then
|
if [ "$template_invalid" -eq 1 ]; then
|
||||||
[[ -f "$template_path" ]] && rm -f "$template_path"
|
[[ -f "$template_path" ]] && rm -f "$template_path"
|
||||||
|
|
||||||
for attempt in {1..3}; do
|
msg_info "Downloading LXC template..."
|
||||||
msg_info "Attempt $attempt: Downloading LXC template..."
|
|
||||||
if timeout 120 pveam download "$TEMPLATE_STORAGE" "$TEMPLATE" >/dev/null 2>&1; then
|
if timeout 120 pveam download "$TEMPLATE_STORAGE" "$TEMPLATE" >/dev/null 2>&1; then
|
||||||
msg_ok "Template download successful."
|
msg_ok "Template download successful."
|
||||||
ensure_template_ready
|
else
|
||||||
return
|
msg_error "Template download failed. Check internet or run manually:\n pveam download $TEMPLATE_STORAGE $TEMPLATE"
|
||||||
fi
|
|
||||||
sleep $((attempt * 5))
|
|
||||||
done
|
|
||||||
|
|
||||||
msg_error "Template download failed after 3 attempts. Check internet or run:\n pveam download $TEMPLATE_STORAGE $TEMPLATE"
|
|
||||||
exit 208
|
exit 208
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
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