From c8a974998ff5374563c964a0c58839e76fa98097 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 22 Jan 2024 17:32:44 +0100 Subject: [PATCH] Cleanup + rename confusing 'app_id' question --- manifest.toml | 2 +- scripts/backup | 11 ----------- scripts/install | 16 +--------------- scripts/remove | 29 ----------------------------- scripts/restore | 9 +-------- scripts/upgrade | 28 ++++------------------------ 6 files changed, 7 insertions(+), 88 deletions(-) diff --git a/manifest.toml b/manifest.toml index 143e0a7..dbe5773 100644 --- a/manifest.toml +++ b/manifest.toml @@ -30,7 +30,7 @@ ram.build = "50M" ram.runtime = "50M" [install] - [install.app_id] + [install.custom_webapp_id] ask.en = "Indicate the ID of the Custom Webapp where you want to install this app" ask.fr = "Indiquez l'ID de la Custom Webapp dans laquelle vous voulez installer cette app" help.en = "You can get the ID in Custom Webapp's settings." diff --git a/scripts/backup b/scripts/backup index c2ee80f..13c4781 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,12 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -15,10 +8,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_print_info --message="Declaring files to be backed up..." -#================================================= -# BACKUP THE APP MAIN DIR -#================================================= - ynh_backup --src_path="$install_dir" #================================================= diff --git a/scripts/install b/scripts/install index 964f586..04829f8 100755 --- a/scripts/install +++ b/scripts/install @@ -1,22 +1,8 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." - -ynh_app_setting_set --app=$app --key=app_id --value=$app_id -ynh_app_setting_set --app=$app --key=sub_folder --value=$sub_folder - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -26,7 +12,7 @@ ynh_script_progression --message="Setting up source files..." ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app_id:www-data "$install_dir" +chown -R $custom_webapp_id:www-data "$install_dir" #================================================= # GENERIC FINALIZATION diff --git a/scripts/remove b/scripts/remove index 0e21928..e957053 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,35 +1,6 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# STANDARD REMOVE -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - -#================================================= -# END OF SCRIPT -#================================================= - ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 8c4cbbc..0f64cf9 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,12 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -20,7 +13,7 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app_id:www-data "$install_dir" +chown -R $custom_webapp_id:www-data "$install_dir" #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index b0fe0d4..57a1add 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,39 +1,19 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." +ynh_script_progression --message="Upgrading source files..." - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep="/data" -fi +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir" --keep="/data" chmod -R o-rwx "$install_dir" -chown -R $app_id:www-data "$install_dir" +chown -R $custom_webapp_id:www-data "$install_dir" #================================================= # GENERIC FINALIZATION