add helper function for get_arch_value

This commit is contained in:
Sam Heinz
2026-05-13 01:07:44 +10:00
parent 9b5aab46bd
commit b1eec90772
2 changed files with 21 additions and 0 deletions
+1
View File
@@ -3838,6 +3838,7 @@ build_container() {
export ENABLE_TUN="$ENABLE_TUN"
export PCT_OSTYPE="$var_os"
export PCT_OSVERSION="$var_version"
export PCT_ARCH="$(dpkg --print-architecture 2>/dev/null || uname -m)"
export PCT_DISK_SIZE="$DISK_SIZE"
export IPV6_METHOD="$IPV6_METHOD"
export ENABLE_GPU="$ENABLE_GPU"
+20
View File
@@ -360,6 +360,26 @@ arch_check() {
fi
}
# ------------------------------------------------------------------------------
# get_arch_value()
#
# - Selects an architecture-specific value while preserving amd64 defaults
# - Usage: get_arch_value "amd64-value" "arm64-value"
# - Defaults: amd64="amd64", arm64="arm64"
# ------------------------------------------------------------------------------
get_arch_value() {
local amd64_val="${1:-amd64}"
local arm64_val="${2:-arm64}"
case "$PCT_ARCH" in
amd64) echo "$amd64_val" ;;
arm64) echo "$arm64_val" ;;
*)
msg_error "Unsupported architecture: $PCT_ARCH"
return 106
;;
esac
}
# ------------------------------------------------------------------------------
# ssh_check()
#