diff --git a/conf/arm.src b/conf/arm.src new file mode 100644 index 0000000..c59cf88 --- /dev/null +++ b/conf/arm.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://github.com/writeas/writefreely/releases/download/v0.10.0/writefreely_0.10.0_linux_arm7.tar.gz +SOURCE_SUM=a746db116272d5ded74cd5556b56ed2f2c4f6af1785f44e6254b63adee0a7d92 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= diff --git a/conf/x86-64.src b/conf/x86-64.src index b7871a7..ab1ad89 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,5 +1,5 @@ SOURCE_URL=https://github.com/writeas/writefreely/releases/download/v0.10.0/writefreely_0.10.0_linux_amd64.tar.gz -SOURCE_SUM=6dea841d2f81abd0569915011f183aa818a6f2750da1f953848e05bc49073f3d +SOURCE_SUM=11498cfc579b94326bdae0b61a992ba4ee3a0200a83920043c1d8ea3bdce8380 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=false diff --git a/scripts/detect_arch b/scripts/detect_arch deleted file mode 100644 index ba04b7e..0000000 --- a/scripts/detect_arch +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -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 arm)" ]; then - architecture="arm" -else - ynh_die "Unable to detect your achitecture, please open a bug describing \ - your hardware and the result of the command \"uname -m\"." 1 -fi diff --git a/scripts/install b/scripts/install index fe0915c..c82280a 100755 --- a/scripts/install +++ b/scripts/install @@ -7,7 +7,7 @@ #================================================= source _common.sh -source detect_arch +source ynh_detect_arch__2 source /usr/share/yunohost/helpers #================================================= @@ -33,6 +33,8 @@ is_public=$YNH_APP_ARG_IS_PUBLIC password=$YNH_APP_ARG_PASSWORD single_user=$YNH_APP_ARG_SINGLE_USER +architecture=$(ynh_detect_arch) + # Bypass package_checker name not compatible with writefreely if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then admin="test" @@ -45,10 +47,10 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_print_info --message="Validating installation parameters..." -# Check machine architecture (in particular, we don't support ARM and 32bit machines) -if [ $architecture == "x86_64" ] || [ $architecture == "arm" ] +# Check machine architecture, we don't support 32bit machines +if [ $architecture = "i386" ] then - ynh_die --message="Sorry, but this app can only be installed on a x86, 64 bits machine :(" + ynh_die --message="Sorry, but this app cannot be installed on a i386 32 bits machine :(" fi final_path=/var/www/$app diff --git a/scripts/upgrade b/scripts/upgrade index 69ba829..f486d9a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,7 +7,7 @@ #================================================= source _common.sh -source detect_arch +source ynh_detect_arch__2 source ynh_check_app_version_changed source /usr/share/yunohost/helpers @@ -27,6 +27,8 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) port=$(ynh_app_setting_get --app=$app --key=port) +architecture=$(ynh_detect_arch) + #================================================= # CHECK VERSION #================================================= diff --git a/scripts/ynh_detect_arch__2 b/scripts/ynh_detect_arch__2 new file mode 100644 index 0000000..b1c7375 --- /dev/null +++ b/scripts/ynh_detect_arch__2 @@ -0,0 +1,25 @@ +#!/bin/bash + +# Check the architecture +# +# example: architecture=$(ynh_detect_arch) +# +# usage: ynh_detect_arch +# +# Requires YunoHost version 2.2.4 or higher. + +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 arm)" ]; then + architecture="arm" + else + architecture="unknown" + fi + echo $architecture +}