From 3e32fb100ce0634979074420e9d0646259045865 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Tue, 15 Mar 2022 22:47:43 +0100 Subject: [PATCH] attempt to detect armv6 and armv7 --- scripts/_common.sh | 18 ++++++++++++++++++ scripts/install | 3 ++- scripts/upgrade | 3 ++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index c0220ac..55dc9b2 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -11,6 +11,24 @@ pkg_dependencies="postgresql postgresql-contrib" # PERSONAL HELPERS #================================================= +ynh_detect_arch(){ + local architecture + if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then + architecture="arm64" + elif [ -n "$(uname -m | grep 64)" ]; then + architecture="x86-64" + elif [ -n "$(uname -m | grep 86)" ]; then + architecture="i386" + elif [ -n "$(uname -m | grep armv6)" ]; then + architecture="armv6" + elif [ -n "$(uname -m | grep armv7)" ]; then + architecture="armv7" + else + architecture="unknown" + fi + echo $architecture +} + #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index d29a529..5c68f6d 100755 --- a/scripts/install +++ b/scripts/install @@ -140,7 +140,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1 ### downloaded from an upstream source, like a git repository. ### `ynh_setup_source` use the file conf/app.src -architecture=$YNH_ARCH +# ynh_detect_arch comes from _common.sh / personnal helpers +architecture=$ynh_detect_arch # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" --source_id=$architecture diff --git a/scripts/upgrade b/scripts/upgrade index 291f73f..6b06e3c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -83,7 +83,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." - architecture=$YNH_ARCH + # ynh_detect_arch comes from _common.sh / personnal helpers + architecture=$ynh_detect_arch # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" --source_id=$architecture --keep="config.yaml"