From 1c74971f8cd2df8c47ca8d42c649d9feb188ec68 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 20 Nov 2021 18:53:23 +0100 Subject: [PATCH] Remove arch helper --- .github/workflows/updater.sh | 4 ++-- conf/{x86-64.src => amd64.src} | 0 conf/{arm.src => armhf.src} | 0 manifest.json | 8 +++----- scripts/install | 1 + scripts/remove | 12 ++++++++++++ scripts/restore | 2 -- scripts/upgrade | 2 +- scripts/ynh_detect_arch__2 | 14 -------------- 9 files changed, 19 insertions(+), 24 deletions(-) rename conf/{x86-64.src => amd64.src} (100%) rename conf/{arm.src => armhf.src} (100%) delete mode 100644 scripts/ynh_detect_arch__2 diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index 54a624f..dc09aa4 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -64,7 +64,7 @@ echo "Handling asset at $asset_url" # Leave $src empty to ignore the asset case $asset_url in *"linux-arm-"*) - src="arm" + src="armhf" ;; *"linux-arm64-"*) src="arm64" @@ -73,7 +73,7 @@ case $asset_url in src="i386" ;; *"linux-amd64-"*) - src="x86-64" + src="amd64" ;; *) src="" diff --git a/conf/x86-64.src b/conf/amd64.src similarity index 100% rename from conf/x86-64.src rename to conf/amd64.src diff --git a/conf/arm.src b/conf/armhf.src similarity index 100% rename from conf/arm.src rename to conf/armhf.src diff --git a/manifest.json b/manifest.json index b4508d2..fb1358e 100644 --- a/manifest.json +++ b/manifest.json @@ -25,7 +25,7 @@ } ], "requirements": { - "yunohost": ">= 4.1.3" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ @@ -35,8 +35,7 @@ "install": [ { "name": "domain", - "type": "domain", - "example": "example.com" + "type": "domain" }, { "name": "path", @@ -46,8 +45,7 @@ }, { "name": "admin", - "type": "user", - "example": "johndoe" + "type": "user" } ] } diff --git a/scripts/install b/scripts/install index e4938d0..3b21a35 100644 --- a/scripts/install +++ b/scripts/install @@ -27,6 +27,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN +architecture=$YNH_ARCH app=$YNH_APP_INSTANCE_NAME diff --git a/scripts/remove b/scripts/remove index 455f8b1..5fb98ea 100644 --- a/scripts/remove +++ b/scripts/remove @@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +sync_home=$(ynh_app_setting_get --app=$app --key=sync_home) sync_port=$(ynh_app_setting_get --app=$app --key=sync_port) @@ -50,6 +51,17 @@ ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" +#================================================= +# REMOVE DATA DIR +#================================================= + +# Remove the app data directory with the command `yunohost app remove syncthing --purge` +if [ "${YNH_APP_PURGE:-0}" -eq 1 ] +then + ynh_script_progression --message="Removing $app data directory..." --weight=2 + ynh_secure_remove --file="$sync_home" +fi + #================================================= # REMOVE NGINX CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index b735318..c7a2f0b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -38,8 +38,6 @@ sync_port=$(ynh_app_setting_get --app=$app --key=sync_port) #================================================= ynh_script_progression --message="Validating restoration parameters..." -ynh_webpath_available --domain=$domain --path_url=$path_url \ - || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " diff --git a/scripts/upgrade b/scripts/upgrade index 1cd65ce..1a7d922 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +architecture=$YNH_ARCH sync_home=$(ynh_app_setting_get --app=$app --key=sync_home) sync_port=$(ynh_app_setting_get --app=$app --key=sync_port) @@ -100,7 +101,6 @@ if [ -z $gui_port ]; then ynh_remove_logrotate ynh_remove_app_dependencies - fi # Cleaning legacy permissions diff --git a/scripts/ynh_detect_arch__2 b/scripts/ynh_detect_arch__2 deleted file mode 100644 index ba04b7e..0000000 --- a/scripts/ynh_detect_arch__2 +++ /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