From 22858d7c3dcdd875a7eddc6f78b013b285956f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:06:35 +0200 Subject: [PATCH] cleaning --- manifest.toml | 3 --- scripts/install | 17 ++--------------- scripts/remove | 16 ++-------------- scripts/restore | 26 ++++++++------------------ scripts/upgrade | 20 ++------------------ 5 files changed, 14 insertions(+), 68 deletions(-) diff --git a/manifest.toml b/manifest.toml index 290ef23..e7dc8cf 100644 --- a/manifest.toml +++ b/manifest.toml @@ -29,11 +29,9 @@ ram.runtime = "10M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" [install.path] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "path" default = "/cheky" @@ -42,7 +40,6 @@ ram.runtime = "10M" default = "visitors" [install.password] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "password" [resources] diff --git a/scripts/install b/scripts/install index cc3c062..6a3cdc9 100644 --- a/scripts/install +++ b/scripts/install @@ -17,31 +17,18 @@ ynh_script_progression --message="Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= -# NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 ynh_add_nginx_config -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring PHP-FPM..." - ynh_add_fpm_config -#================================================= -# SPECIFIC SETUP -#================================================= -# Add cron job -#================================================= -ynh_script_progression --message="Configuring a cron task..." - ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" diff --git a/scripts/remove b/scripts/remove index d96cede..5707ff0 100644 --- a/scripts/remove +++ b/scripts/remove @@ -10,26 +10,14 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# REMOVE NGINX CONFIGURATION +# REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." - ynh_remove_fpm_config -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." - ynh_secure_remove --file="/etc/cron.d/$app" #================================================= diff --git a/scripts/restore b/scripts/restore index f0a9e3a..1390c74 100644 --- a/scripts/restore +++ b/scripts/restore @@ -9,14 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -24,17 +16,9 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - #================================================= # RESTORE THE MYSQL DATABASE #================================================= @@ -43,9 +27,15 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=3 ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql #================================================= -# RESTORE THE CRON FILE +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring various files..." --weight=1 +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/cron.d/$app" diff --git a/scripts/upgrade b/scripts/upgrade index ad5303b..b1080a1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,17 +12,9 @@ source /usr/share/yunohost/helpers #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -35,29 +27,21 @@ then ynh_setup_source --dest_dir="$install_dir" fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -# NGINX CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 ynh_add_nginx_config -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3 - ynh_add_fpm_config #================================================= # SPECIFIC UPGRADE #================================================= -# ... -#================================================= ynh_script_progression --message="Running specific upgrade..." --weight=1 # Copy Yunohost custom script to cheky folder and launch it