Update build.func

This commit is contained in:
CanbiZ 2025-11-24 15:07:27 +01:00
parent dbaa41584b
commit b2abad19ba

View File

@ -535,27 +535,6 @@ base_settings() {
TAGS="community-script,${var_tags:-}"
ENABLE_FUSE=${var_fuse:-"${1:-no}"}
ENABLE_TUN=${var_tun:-"${1:-no}"}
ENABLE_NESTING=${var_nesting:-"${1:-1}"}
ENABLE_KEYCTL=${var_keyctl:-"${1:-0}"}
ALLOW_MOUNT_FS=${var_mount_fs:-""}
ENABLE_MKNOD=${var_mknod:-"${1:-0}"}
PROTECT_CT=${var_protection:-"${1:-no}"}
CT_TIMEZONE=${var_timezone:-""}
# Normalize numeric feature flags (handle both yes/no and 0/1 formats)
# Keep ENABLE_FUSE as yes/no for backward compatibility
case "${ENABLE_NESTING,,}" in
yes | true | 1) ENABLE_NESTING="1" ;;
no | false | 0) ENABLE_NESTING="0" ;;
esac
case "${ENABLE_KEYCTL,,}" in
yes | true | 1) ENABLE_KEYCTL="1" ;;
no | false | 0) ENABLE_KEYCTL="0" ;;
esac
case "${ENABLE_MKNOD,,}" in
yes | true | 1) ENABLE_MKNOD="1" ;;
no | false | 0) ENABLE_MKNOD="0" ;;
esac
# Since these 2 are only defined outside of default_settings function, we add a temporary fallback. TODO: To align everything, we should add these as constant variables (e.g. OSTYPE and OSVERSION), but that would currently require updating the default_settings function for all existing scripts
if [ -z "$var_os" ]; then
@ -2373,22 +2352,8 @@ build_container() {
export DEV_MODE_LOGS="${DEV_MODE_LOGS:-false}"
export DEV_MODE_DRYRUN="${DEV_MODE_DRYRUN:-false}"
# Build PCT_OPTIONS as multi-line string (arrays cannot be exported!)
# Use FEATURES_ARRAY to build the FEATURES string
FEATURES_STRING=""
for feature in "${FEATURES_ARRAY[@]}"; do
if [ -z "$FEATURES_STRING" ]; then
FEATURES_STRING="$feature"
else
FEATURES_STRING="$FEATURES_STRING,$feature"
fi
done
# DEBUG: Show converted FEATURES_STRING
echo "[DEBUG] FEATURES_STRING (comma-separated): $FEATURES_STRING"
# Start building PCT_OPTIONS as a string
PCT_OPTIONS_STRING=" -features $FEATURES_STRING
# Build PCT_OPTIONS as multi-line string
PCT_OPTIONS_STRING=" -features $FEATURES
-hostname $HN
-tags $TAGS"