From a784576bafc3a821594908c75a9f3136a251e3b5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 1 Nov 2020 21:22:57 +0100 Subject: [PATCH] Fix --- scripts/_common.sh | 5 +---- scripts/change_url | 26 ++++---------------------- scripts/install | 2 +- scripts/restore | 13 +++---------- scripts/upgrade | 20 +++++++------------- 5 files changed, 16 insertions(+), 50 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 748d973..d7614e9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,9 +6,6 @@ YNH_PHP_VERSION="7.3" -# dependencies used by the app -pkg_dependencies="" - #================================================= # PERSONAL HELPERS #================================================= @@ -19,4 +16,4 @@ pkg_dependencies="" #================================================= # FUTURE OFFICIAL HELPERS -#================================================= \ No newline at end of file +#================================================= diff --git a/scripts/change_url b/scripts/change_url index 2a179bf..17377e5 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -62,19 +62,10 @@ then change_path=1 fi -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 - -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" - #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -100,19 +91,10 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi -#================================================= -# GENERIC FINALISATION -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -120,4 +102,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 5b10b75..758af0c 100644 --- a/scripts/install +++ b/scripts/install @@ -88,7 +88,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # Set permissions to app files -chown -R root: $final_path +chown -R $app: $final_path #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index cab0d9b..a0de85a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -67,7 +67,7 @@ ynh_system_user_create --username=$app #================================================= # Restore permissions on app files -chown -R root: $final_path +chown -R $app: $final_path #================================================= # RESTORE THE PHP-FPM CONFIGURATION @@ -90,19 +90,12 @@ ynh_script_progression --message="Integrating service in YunoHost..." --time --w yunohost service add $app --description "A short description of the app" --log "/var/log/$app/$app.log" -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --time --weight=1 ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload @@ -111,4 +104,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index f46f476..77c47f1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -41,12 +41,6 @@ elif [ "$is_public" = "No" ]; then is_public=0 fi -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - # If final_path doesn't exist, create it if [ -z "$final_path" ]; then final_path=/var/www/$app @@ -82,9 +76,9 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --time --weight=1 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -98,7 +92,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --time --weight=1 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -109,7 +103,7 @@ ynh_add_fpm_config ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1 # Create a dedicated systemd config -ynh_add_systemd_config +ynh_add_systemd_config --phpversion=$YNH_PHP_VERSION #================================================= # GENERIC FINALIZATION @@ -118,7 +112,7 @@ ynh_add_systemd_config #================================================= # Set permissions on app files -chown -R root: $final_path +chown -R $app: $final_path #================================================= # INTEGRATE SERVICE IN YUNOHOST @@ -130,7 +124,7 @@ yunohost service add $app --description "A short description of the app" --log " #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -138,4 +132,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --time --last +ynh_script_progression --message="Upgrade of $app completed" --last