From 4681c08ae82bb5729871696ad9a411fc971b8cd4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 4 Dec 2021 23:50:03 +0100 Subject: [PATCH] arch --- conf/{x86_64.src => amd64.src} | 1 + conf/arm64.src | 1 + conf/i386.src | 1 + conf/nginx.conf | 5 ----- scripts/_common.sh | 21 --------------------- scripts/install | 7 +------ scripts/remove | 13 +++++++------ scripts/upgrade | 7 +------ 8 files changed, 12 insertions(+), 44 deletions(-) rename conf/{x86_64.src => amd64.src} (89%) diff --git a/conf/x86_64.src b/conf/amd64.src similarity index 89% rename from conf/x86_64.src rename to conf/amd64.src index 6489df8..f2281a6 100644 --- a/conf/x86_64.src +++ b/conf/amd64.src @@ -3,4 +3,5 @@ SOURCE_SUM=d2f535e4cd0449b357a563cfce79c1f6afcac9b7b3af94e758defc44faa52ebf SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=gz SOURCE_IN_SUBDIR=false +SOURCE_FILENAME=simple-torrent SOURCE_EXTRACT=false diff --git a/conf/arm64.src b/conf/arm64.src index 6c4b48d..f374176 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -3,4 +3,5 @@ SOURCE_SUM=6f48f8b59bc8d834c6ede1d27ecc1a598b8a0be1dab00622caa6fd047e51eed6 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=gz SOURCE_IN_SUBDIR=false +SOURCE_FILENAME=simple-torrent SOURCE_EXTRACT=false diff --git a/conf/i386.src b/conf/i386.src index dd17e3a..47e8bd2 100644 --- a/conf/i386.src +++ b/conf/i386.src @@ -3,4 +3,5 @@ SOURCE_SUM=583898eb907c21dbbcb6f33934eae3dc1d6ec2620fdc7689c70a3479049af52b SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=gz SOURCE_IN_SUBDIR=false +SOURCE_FILENAME=simple-torrent SOURCE_EXTRACT=false diff --git a/conf/nginx.conf b/conf/nginx.conf index d8ac826..f1a7df9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,10 +1,5 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } proxy_pass http://127.0.0.1:__PORT__/; proxy_redirect off; diff --git a/scripts/_common.sh b/scripts/_common.sh index 8fc49a5..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -15,24 +15,3 @@ #================================================= # FUTURE OFFICIAL HELPERS #================================================= - -# 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 86)" ]; then - architecture="i386" - elif [ -n "$(uname -m | grep 64)" ]; then - architecture="x86_64" - else - architecture="unknown" - fi - echo $architecture -} diff --git a/scripts/install b/scripts/install index 12beb0c..cf24677 100644 --- a/scripts/install +++ b/scripts/install @@ -23,7 +23,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC -architecture=$(ynh_detect_arch) +architecture=$YNH_ARCH app=$YNH_APP_INSTANCE_NAME @@ -88,11 +88,6 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$final_path --source_id="$architecture" -pushd "$final_path" - gzip --decompress $(ynh_detect_arch).gz - mv $(ynh_detect_arch) $app -popd - chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" diff --git a/scripts/remove b/scripts/remove index 8fef2b5..5abf796 100644 --- a/scripts/remove +++ b/scripts/remove @@ -55,12 +55,13 @@ ynh_secure_remove --file="$final_path" # REMOVE DATA DIR #================================================= -# # Remove the app data directory with the command `yunohost app remove --purge` -# if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -# then -# ynh_script_progression --message="Removing $app data directory..." --weight=2 -# ynh_secure_remove --file="$datadir" -# fi +# Remove the app data directory with the command `yunohost app remove --purge` +# Remove the data directory if --purge option is used +if [ "${YNH_APP_PURGE:-0}" -eq 1 ] +then + ynh_script_progression --message="Removing app data directory..." --weight=1 + ynh_secure_remove --file="$datadir" +fi #================================================= # REMOVE NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index b7e46f0..33de52e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) peer_port=$(ynh_app_setting_get --app=$app --key=peer_port) -architecture=$(ynh_detect_arch) +architecture=$YNH_ARCH #================================================= # CHECK VERSION @@ -88,11 +88,6 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$final_path --source_id="$architecture" --keep="$final_path/config.yml" - - pushd "$final_path" - gzip --decompress $(ynh_detect_arch).gz - mv $(ynh_detect_arch) $app - popd fi chmod 750 "$final_path"