Update create_lxc.sh
This commit is contained in:
parent
dcfe74d7a3
commit
6ccb62d19e
@ -262,6 +262,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Get LXC template string
|
# Get LXC template string
|
||||||
|
# TEMPLATE_SEARCH und TEMPLATES
|
||||||
TEMPLATE_SEARCH="${PCT_OSTYPE}-${PCT_OSVERSION:-}"
|
TEMPLATE_SEARCH="${PCT_OSTYPE}-${PCT_OSVERSION:-}"
|
||||||
mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($TEMPLATE_SEARCH.*\)/\1/p" | sort -t - -k 2 -V)
|
mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($TEMPLATE_SEARCH.*\)/\1/p" | sort -t - -k 2 -V)
|
||||||
|
|
||||||
@ -269,7 +270,8 @@ if [ ${#TEMPLATES[@]} -eq 0 ]; then
|
|||||||
msg_error "No matching LXC template found for '${TEMPLATE_SEARCH}'. Make sure your host can reach the Proxmox template repository."
|
msg_error "No matching LXC template found for '${TEMPLATE_SEARCH}'. Make sure your host can reach the Proxmox template repository."
|
||||||
exit 207
|
exit 207
|
||||||
fi
|
fi
|
||||||
ensure_template_ready
|
|
||||||
|
TEMPLATE="${TEMPLATES[-1]}"
|
||||||
|
|
||||||
function ensure_template_ready() {
|
function ensure_template_ready() {
|
||||||
local template_path
|
local template_path
|
||||||
@ -295,7 +297,6 @@ function ensure_template_ready() {
|
|||||||
msg_info "Attempt $attempt: 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."
|
||||||
# 🔁 Nach erfolgreichem Download rekursiv erneut prüfen
|
|
||||||
ensure_template_ready
|
ensure_template_ready
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -309,6 +310,8 @@ function ensure_template_ready() {
|
|||||||
msg_ok "LXC Template '$TEMPLATE' is ready to use."
|
msg_ok "LXC Template '$TEMPLATE' is ready to use."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensure_template_ready
|
||||||
|
|
||||||
msg_info "Creating LXC Container"
|
msg_info "Creating LXC Container"
|
||||||
# Check and fix subuid/subgid
|
# Check and fix subuid/subgid
|
||||||
grep -q "root:100000:65536" /etc/subuid || echo "root:100000:65536" >>/etc/subuid
|
grep -q "root:100000:65536" /etc/subuid || echo "root:100000:65536" >>/etc/subuid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user