Debugcontainer build options handling
Changed PCT_OPTIONS from an array to a string for proper export and compatibility with Proxmox pct. Features are now passed as a comma-separated string. Also updated install.func to use a literal heredoc for systemd override configuration.
This commit is contained in:
parent
b87558b415
commit
894449182d
@ -2351,46 +2351,39 @@ build_container() {
|
|||||||
export PCT_OSVERSION="$var_version"
|
export PCT_OSVERSION="$var_version"
|
||||||
export PCT_DISK_SIZE="$DISK_SIZE"
|
export PCT_DISK_SIZE="$DISK_SIZE"
|
||||||
|
|
||||||
# Build PCT_OPTIONS array (not string) for proper parameter handling
|
# Build FEATURES string from array
|
||||||
PCT_OPTIONS=()
|
# Proxmox pct expects comma-separated features: -features nesting=1,keyctl=1,fuse=1
|
||||||
|
FEATURES=$(
|
||||||
|
IFS=,
|
||||||
|
echo "${FEATURES_ARRAY[*]}"
|
||||||
|
)
|
||||||
|
|
||||||
# Add features - each as separate -features parameter
|
# Build PCT_OPTIONS as string (must be string for export to work)
|
||||||
for feature in "${FEATURES_ARRAY[@]}"; do
|
PCT_OPTIONS="-features $FEATURES
|
||||||
PCT_OPTIONS+=("-features" "$feature")
|
-hostname $HN
|
||||||
done
|
-tags $TAGS
|
||||||
|
$SD
|
||||||
|
$NS
|
||||||
|
$NET_STRING
|
||||||
|
-onboot 1
|
||||||
|
-cores $CORE_COUNT
|
||||||
|
-memory $RAM_SIZE
|
||||||
|
-unprivileged $CT_TYPE"
|
||||||
|
|
||||||
PCT_OPTIONS+=("-hostname" "$HN")
|
# Add optional flags
|
||||||
PCT_OPTIONS+=("-tags" "$TAGS")
|
|
||||||
|
|
||||||
if [ -n "$SD" ]; then
|
|
||||||
PCT_OPTIONS+=($SD) # Storage device flags (already formatted)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$NS" ]; then
|
|
||||||
PCT_OPTIONS+=($NS) # Nameserver flags (already formatted)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Network configuration (single string with all network parameters)
|
|
||||||
PCT_OPTIONS+=($NET_STRING)
|
|
||||||
|
|
||||||
PCT_OPTIONS+=("-onboot" "1")
|
|
||||||
PCT_OPTIONS+=("-cores" "$CORE_COUNT")
|
|
||||||
PCT_OPTIONS+=("-memory" "$RAM_SIZE")
|
|
||||||
PCT_OPTIONS+=("-unprivileged" "$CT_TYPE")
|
|
||||||
|
|
||||||
# Protection flag
|
|
||||||
if [ "$PROTECT_CT" == "1" ]; then
|
if [ "$PROTECT_CT" == "1" ]; then
|
||||||
PCT_OPTIONS+=("-protection" "1")
|
PCT_OPTIONS="$PCT_OPTIONS
|
||||||
|
-protection 1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Timezone flag
|
|
||||||
if [ -n "$CT_TIMEZONE" ]; then
|
if [ -n "$CT_TIMEZONE" ]; then
|
||||||
PCT_OPTIONS+=("-timezone" "$CT_TIMEZONE")
|
PCT_OPTIONS="$PCT_OPTIONS
|
||||||
|
-timezone $CT_TIMEZONE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Password flag (already formatted as "-password xxx")
|
|
||||||
if [ -n "$PW" ]; then
|
if [ -n "$PW" ]; then
|
||||||
PCT_OPTIONS+=($PW)
|
PCT_OPTIONS="$PCT_OPTIONS
|
||||||
|
$PW"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PCT_OPTIONS
|
export PCT_OPTIONS
|
||||||
|
|||||||
@ -257,10 +257,10 @@ customize() {
|
|||||||
msg_info "Customizing Container"
|
msg_info "Customizing Container"
|
||||||
GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf"
|
GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf"
|
||||||
mkdir -p $(dirname $GETTY_OVERRIDE)
|
mkdir -p $(dirname $GETTY_OVERRIDE)
|
||||||
cat <<EOF >$GETTY_OVERRIDE
|
cat <<'EOF' >$GETTY_OVERRIDE
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=
|
ExecStart=
|
||||||
ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM
|
ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 $TERM
|
||||||
EOF
|
EOF
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
|
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user