From 0dd4b2d504d6822122de7f013da2c65704fb0401 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Wed, 7 May 2025 11:35:18 +0200 Subject: [PATCH] Update create_lxc.sh --- ct/create_lxc.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ct/create_lxc.sh b/ct/create_lxc.sh index b8609b9..9f445fb 100644 --- a/ct/create_lxc.sh +++ b/ct/create_lxc.sh @@ -283,6 +283,14 @@ if [ "$UDHCPC_FIX" == "yes" ]; then CT_ROOT="/var/lib/lxc/${CTID}/rootfs" CONFIG_FILE="$CT_ROOT/etc/udhcpc/udhcpc.conf" + # wait max. 5 seconds for rootfs + for i in {1..10}; do + if [ -f "$CONFIG_FILE" ]; then + break + fi + sleep 0.5 + done + if [ -f "$CONFIG_FILE" ]; then msg_info "Patching udhcpc.conf for Alpine DNS override" sed -i '/^#*RESOLV_CONF="/d' "$CONFIG_FILE" @@ -296,7 +304,7 @@ if [ "$UDHCPC_FIX" == "yes" ]; then ' "$CONFIG_FILE" >"${CONFIG_FILE}.tmp" && mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE" msg_ok "Patched udhcpc.conf (RESOLV_CONF=\"no\")" else - msg_error "udhcpc.conf not found in $CONFIG_FILE" + msg_error "udhcpc.conf not found in $CONFIG_FILE after waiting" fi fi msg_ok "LXC Container ${BL}$CTID${CL} ${GN}was successfully created."