From e69b3fe63308cef91ed5529ff3b817a28e5332dc Mon Sep 17 00:00:00 2001 From: George Kitsos Date: Wed, 2 Oct 2024 12:39:59 +0300 Subject: [PATCH] fix: Add check to install linux-modules-extra- on arm64 resources (#7) Co-authored-by: George Kitsos --- .../onm/onm-bootstrap.sh | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/network-manager/bootstrap-agent-scripts/onm/onm-bootstrap.sh b/network-manager/bootstrap-agent-scripts/onm/onm-bootstrap.sh index 76b5bc1..08abe5f 100755 --- a/network-manager/bootstrap-agent-scripts/onm/onm-bootstrap.sh +++ b/network-manager/bootstrap-agent-scripts/onm/onm-bootstrap.sh @@ -14,6 +14,17 @@ exec 3>&1 4>&2 trap 'exec 2>&4 1>&3' 0 1 2 3 exec 1>$LOGFILE 2>&1 +# Find Resource Architecture +ARCH_COMMAND=$(sudo arch) +AMD_ARCH="x86_64" +ARM_ARCH="aarch64" + +if [ "$ARCH_COMMAND" = "$AMD_ARCH" ]; then + ARCHITECTURE="amd64" +elif [ "$ARCH_COMMAND" = "$ARM_ARCH" ]; then + ARCHITECTURE="arm64" +fi + # A function to print a message to the stdout as well as as the LOGFILE log_print(){ level=$1 @@ -187,6 +198,16 @@ if [ "$ACTION" == "CREATE" ]; then sudo apt-get update + # Check if the architecture is arm64 + if [ "$ARCHITECTURE" = "arm64" ]; then + KERNEL_VERSION=$(uname -r) + LINUX_MODULE="linux-modules-extra-${KERNEL_VERSION}" + log_print INFO "onm-bootstrap($PID): Architecture is $ARCHITECTURE. Installing... $LINUX_MODULE" + + Check_lock + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y $LINUX_MODULE + fi + log_print INFO "onm-bootstrap($PID): Installing wireguard and resolvconf..." Check_lock