From c63efea33fbe23441c6d7c79cf442cc1efa7960c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 2 Jan 2024 23:13:36 +0100 Subject: [PATCH] cleaning --- scripts/install | 7 ++----- scripts/remove | 14 -------------- scripts/restore | 22 ++++++---------------- scripts/upgrade | 14 +++----------- 4 files changed, 11 insertions(+), 46 deletions(-) diff --git a/scripts/install b/scripts/install index 785553a..e4cd513 100755 --- a/scripts/install +++ b/scripts/install @@ -35,7 +35,6 @@ ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage #================================================= 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 -R o-rwx "$install_dir" @@ -47,10 +46,8 @@ chmod -R 775 $install_dir/storage #================================================= ynh_script_progression --message="Configuring PHP-FPM..." -# Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint -# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -67,7 +64,7 @@ ynh_exec_warn_less ynh_install_composer --phpversion=$phpversion --workdir=$inst #================================================= ynh_script_progression --message="Adding a configuration file..." -ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" +ynh_add_config --template=".env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown $app "$install_dir/.env" @@ -95,7 +92,7 @@ popd #================================================= ynh_script_progression --message="Setuping a cron..." -ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +ynh_add_config --template="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 76dc342..6a67d42 100755 --- a/scripts/remove +++ b/scripts/remove @@ -14,24 +14,10 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." - -# Remove the dedicated PHP-FPM config ynh_remove_fpm_config -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." - # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" diff --git a/scripts/restore b/scripts/restore index 5749a98..33d4b55 100755 --- a/scripts/restore +++ b/scripts/restore @@ -20,20 +20,6 @@ ynh_restore_file --origin_path="$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..." - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE MYSQL DATABASE #================================================= @@ -42,9 +28,13 @@ ynh_script_progression --message="Restoring the MySQL database..." ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= -# RESTORE VARIOUS FILES +# RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restoring various files..." +ynh_script_progression --message="Restoring the PHP-FPM configuration..." + +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" chown root: "/etc/cron.d/$app" diff --git a/scripts/upgrade b/scripts/upgrade index 2b5b30d..78dfd26 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -53,7 +53,6 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then 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=".env storage/upload storage/export" fi @@ -66,15 +65,8 @@ chmod -R 775 $install_dir/storage #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." -# Create a dedicated PHP-FPM config -ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." - -# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -91,7 +83,7 @@ ynh_exec_warn_less ynh_install_composer #================================================= # ynh_script_progression --message="Updating a configuration file..." -# ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" +# ynh_add_config --template=".env" --destination="$install_dir/.env" # chmod 400 "$install_dir/.env" # chown $app "$install_dir/.env" @@ -115,7 +107,7 @@ popd #================================================= ynh_script_progression --message="Setuping a cron..." -ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +ynh_add_config --template="cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app"