mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-06-19 22:11:21 +02:00
[arm64] Port scripts titled between A-F to support arm64 (#15181)
This commit is contained in:
+32
-3
@@ -3904,6 +3904,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"
|
||||
@@ -5800,9 +5801,37 @@ create_lxc_container() {
|
||||
url="https://jenkins.linuxcontainers.org/job/image-${PCT_OSTYPE}/architecture=arm64,release=${CUSTOM_TEMPLATE_VARIANT},variant=default/lastStableBuild/artifact/rootfs.tar.xz"
|
||||
|
||||
msg_info "Downloading ${PCT_OSTYPE^} ${CUSTOM_TEMPLATE_VARIANT} ARM64 template"
|
||||
if ! curl -fsSL -o "$dest" "$url"; then
|
||||
msg_error "Failed to download ARM64 template from: $url"
|
||||
exit 208
|
||||
local patched="${dest%/*}/.${dest##*/}.patched"
|
||||
(
|
||||
flock -x 200
|
||||
if [[ -f "$patched" ]] && [[ -s "$dest" ]] && xz -t "$dest" 2>/dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
if ! curl -fsSL -o "$dest" "$url"; then
|
||||
msg_error "Failed to download ARM64 template from: $url"
|
||||
exit 208
|
||||
fi
|
||||
# Some linuxcontainers.org rootfs builds ship without /etc/network,
|
||||
# which makes pve-container's post-create hook fail when it writes the
|
||||
# interfaces file. This appends an empty /etc/network/interfaces if missing.
|
||||
if ! tar -tJf "$dest" 2>/dev/null | grep -q '/etc/network/$'; then
|
||||
fixdir=$(mktemp -d)
|
||||
tmptar="${dest%.xz}"
|
||||
mkdir -p "$fixdir/etc/network"
|
||||
: >"$fixdir/etc/network/interfaces"
|
||||
if xz -d -f "$dest" && tar -C "$fixdir" --append -f "$tmptar" ./etc/network && xz -1 -f "$tmptar"; then
|
||||
rm -rf "$fixdir"
|
||||
else
|
||||
rm -rf "$fixdir" "$tmptar"
|
||||
msg_error "Failed to patch ARM64 template (missing /etc/network)"
|
||||
exit 208
|
||||
fi
|
||||
fi
|
||||
touch "$patched"
|
||||
) 200>"${dest}.lock"
|
||||
local dl_rc=$?
|
||||
if [[ $dl_rc -ne 0 ]]; then
|
||||
exit "$dl_rc"
|
||||
fi
|
||||
msg_ok "Downloaded ARM64 LXC template"
|
||||
}
|
||||
|
||||
@@ -360,6 +360,27 @@ arch_check() {
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# arch_resolve()
|
||||
#
|
||||
# - Selects an architecture-specific value while preserving amd64 defaults
|
||||
# - Usage: arch_resolve "amd64-value" "arm64-value"
|
||||
# - Defaults: amd64="amd64", arm64="arm64"
|
||||
# ------------------------------------------------------------------------------
|
||||
arch_resolve() {
|
||||
local amd64_val="${1:-amd64}"
|
||||
local arm64_val="${2:-arm64}"
|
||||
local arch="${PCT_ARCH:-$(dpkg --print-architecture 2>/dev/null || uname -m)}"
|
||||
case "$arch" in
|
||||
amd64 | x86_64) echo "$amd64_val" ;;
|
||||
arm64 | aarch64) echo "$arm64_val" ;;
|
||||
*)
|
||||
msg_error "Unsupported architecture: $arch"
|
||||
return 106
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ssh_check()
|
||||
#
|
||||
|
||||
+16
-6
@@ -6920,14 +6920,24 @@ setup_mongodb() {
|
||||
export NEEDRESTART_MODE=a
|
||||
export NEEDRESTART_SUSPEND=1
|
||||
|
||||
# Check AVX support
|
||||
if ! grep -qm1 'avx[^ ]*' /proc/cpuinfo; then
|
||||
local major="${MONGO_VERSION%%.*}"
|
||||
if ((major > 5)); then
|
||||
msg_error "MongoDB ${MONGO_VERSION} requires AVX support, which is not available on this system."
|
||||
# Check CPU requirements: AVX on x86_64, NEON/ASIMD on arm64
|
||||
case "$(uname -m)" in
|
||||
aarch64)
|
||||
if ! grep -qm1 'asimd' /proc/cpuinfo; then
|
||||
msg_error "MongoDB ${MONGO_VERSION} requires ARMv8.2-A support, which is not available on this system."
|
||||
return 236
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if ! grep -qm1 'avx[^ ]*' /proc/cpuinfo; then
|
||||
local major="${MONGO_VERSION%%.*}"
|
||||
if ((major > 5)); then
|
||||
msg_error "MongoDB ${MONGO_VERSION} requires AVX support, which is not available on this system."
|
||||
return 236
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$DISTRO_ID" in
|
||||
ubuntu)
|
||||
|
||||
Reference in New Issue
Block a user