Update build.func
This commit is contained in:
parent
222bdedc25
commit
99ac1ac908
@ -2290,8 +2290,15 @@ build_container() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# Build FEATURES_ARRAY with all requested features
|
# Build FEATURES_ARRAY with all requested features
|
||||||
|
# Note: Set safe defaults for all feature flags to prevent undefined variables
|
||||||
|
: "${ENABLE_NESTING:=1}"
|
||||||
|
: "${ENABLE_KEYCTL:=0}"
|
||||||
|
: "${ENABLE_MKNOD:=0}"
|
||||||
|
: "${ENABLE_FUSE:=no}"
|
||||||
|
: "${ALLOW_MOUNT_FS:=}"
|
||||||
|
|
||||||
FEATURES_ARRAY=()
|
FEATURES_ARRAY=()
|
||||||
FEATURES_ARRAY+=("nesting=${ENABLE_NESTING}")
|
FEATURES_ARRAY+=("nesting=$ENABLE_NESTING")
|
||||||
|
|
||||||
# keyctl: needed for Docker inside containers (systemd-networkd workaround)
|
# keyctl: needed for Docker inside containers (systemd-networkd workaround)
|
||||||
if [ "$CT_TYPE" == "1" ] || [ "$ENABLE_KEYCTL" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ] || [ "$ENABLE_KEYCTL" == "1" ]; then
|
||||||
@ -2315,6 +2322,12 @@ build_container() {
|
|||||||
FEATURES_ARRAY+=("mount=$ALLOW_MOUNT_FS_FORMATTED")
|
FEATURES_ARRAY+=("mount=$ALLOW_MOUNT_FS_FORMATTED")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# DEBUG: Show built FEATURES_ARRAY
|
||||||
|
echo "[DEBUG] FEATURES_ARRAY built with ${#FEATURES_ARRAY[@]} elements:"
|
||||||
|
for i in "${!FEATURES_ARRAY[@]}"; do
|
||||||
|
echo " [$i] = ${FEATURES_ARRAY[$i]}"
|
||||||
|
done
|
||||||
|
|
||||||
# NEW IMPLEMENTATION (Fixed): Build PCT_OPTIONS properly
|
# NEW IMPLEMENTATION (Fixed): Build PCT_OPTIONS properly
|
||||||
# Key insight: Bash cannot export arrays, so we build the options as a string
|
# Key insight: Bash cannot export arrays, so we build the options as a string
|
||||||
|
|
||||||
@ -2370,6 +2383,9 @@ build_container() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# DEBUG: Show converted FEATURES_STRING
|
||||||
|
echo "[DEBUG] FEATURES_STRING (comma-separated): $FEATURES_STRING"
|
||||||
|
|
||||||
# Start building PCT_OPTIONS as a string
|
# Start building PCT_OPTIONS as a string
|
||||||
PCT_OPTIONS_STRING=" -features $FEATURES_STRING
|
PCT_OPTIONS_STRING=" -features $FEATURES_STRING
|
||||||
-hostname $HN
|
-hostname $HN
|
||||||
@ -2418,6 +2434,11 @@ build_container() {
|
|||||||
export TEMPLATE_STORAGE="${var_template_storage:-}"
|
export TEMPLATE_STORAGE="${var_template_storage:-}"
|
||||||
export CONTAINER_STORAGE="${var_container_storage:-}"
|
export CONTAINER_STORAGE="${var_container_storage:-}"
|
||||||
|
|
||||||
|
# DEBUG: Show final PCT_OPTIONS being exported
|
||||||
|
echo "[DEBUG] PCT_OPTIONS to be exported:"
|
||||||
|
echo "$PCT_OPTIONS" | sed 's/^/ /'
|
||||||
|
echo "[DEBUG] Calling create_lxc_container..."
|
||||||
|
|
||||||
create_lxc_container || exit $?
|
create_lxc_container || exit $?
|
||||||
|
|
||||||
LXC_CONFIG="/etc/pve/lxc/${CTID}.conf"
|
LXC_CONFIG="/etc/pve/lxc/${CTID}.conf"
|
||||||
@ -3584,6 +3605,17 @@ create_lxc_container() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOGFILE="/tmp/pct_create_${CTID}_$(date +%Y%m%d_%H%M%S)_${SESSION_ID}.log"
|
LOGFILE="/tmp/pct_create_${CTID}_$(date +%Y%m%d_%H%M%S)_${SESSION_ID}.log"
|
||||||
|
|
||||||
|
# DEBUG: Show the actual command that will be executed
|
||||||
|
echo "[DEBUG] ===== PCT CREATE COMMAND DETAILS ====="
|
||||||
|
echo "[DEBUG] CTID: $CTID"
|
||||||
|
echo "[DEBUG] Template: ${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE}"
|
||||||
|
echo "[DEBUG] PCT_OPTIONS (will be word-split):"
|
||||||
|
echo "$PCT_OPTIONS" | sed 's/^/ /'
|
||||||
|
echo "[DEBUG] Full command line:"
|
||||||
|
echo " pct create $CTID ${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE} $PCT_OPTIONS"
|
||||||
|
echo "[DEBUG] ========================================"
|
||||||
|
|
||||||
msg_debug "pct create command: pct create $CTID ${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE} $PCT_OPTIONS"
|
msg_debug "pct create command: pct create $CTID ${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE} $PCT_OPTIONS"
|
||||||
msg_debug "Logfile: $LOGFILE"
|
msg_debug "Logfile: $LOGFILE"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user