From 0aa765045a57c516b9429bca07194226eb043342 Mon Sep 17 00:00:00 2001 From: Yalh Date: Thu, 24 Jan 2019 04:14:10 +0100 Subject: [PATCH] reorder service and admin panel --- scripts/remove | 25 ++++++++++++------------- scripts/restore | 21 ++++++++++++--------- scripts/upgrade | 24 ++++++++++++++++-------- 3 files changed, 40 insertions(+), 30 deletions(-) diff --git a/scripts/remove b/scripts/remove index cde9be7..79cb21c 100755 --- a/scripts/remove +++ b/scripts/remove @@ -23,6 +23,17 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # STANDARD REMOVE +#================================================= +# REMOVE SERVICE FROM ADMIN PANEL +#================================================= + +# Remove a service from the admin panel, added by `yunohost service add` +if yunohost service status | grep -q $app +then + echo "Remove $app service" + yunohost service remove $app +fi + #================================================= # STOP AND REMOVE SERVICE #================================================= @@ -30,17 +41,6 @@ final_path=$(ynh_app_setting_get $app final_path) # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE SERVICE FROM ADMIN PANEL -#================================================= - -# Remove a service from the admin panel, added by `yunohost service add` -#if yunohost service status | grep -q $app -#then -# echo "Remove $app service" -# yunohost service remove $app -#fi - #================================================= # REMOVE DEPENDENCIES #================================================= @@ -68,7 +68,6 @@ ynh_secure_remove "$final_path" # Remove the dedicated nginx config ynh_remove_nginx_config -systemctl restart nginx #================================================= # REMOVE PHP-FPM CONFIGURATION @@ -104,7 +103,7 @@ fi #ynh_secure_remove "/etc/cron.d/$app" # Remove a directory securely -#ynh_secure_remove "/etc/$app/" +ynh_secure_remove "/etc/$app/" # Remove the log files ynh_secure_remove "/var/log/$app/" diff --git a/scripts/restore b/scripts/restore index fb939d1..1740640 100755 --- a/scripts/restore +++ b/scripts/restore @@ -27,8 +27,8 @@ ynh_abort_if_errors app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) -port=$(ynh_app_setting_get $app port) path_url=$(ynh_app_setting_get $app path) +port=$(ynh_app_setting_get $app port) admin=$(ynh_app_setting_get $app admin) is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get $app final_path) @@ -95,7 +95,6 @@ chown -R root: $final_path #================================================= #ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf" -#ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini" #================================================= # SPECIFIC RESTORATION @@ -106,12 +105,6 @@ chown -R root: $final_path # Define and install dependencies #ynh_install_app_dependencies mysql -#================================================= -# ADVERTISE SERVICE IN ADMIN PANEL -#================================================= - -#yunohost service add $app --log "/var/log/$app/APP.log" - #================================================= # RESTORE SYSTEMD #================================================= @@ -119,6 +112,12 @@ chown -R root: $final_path ynh_restore_file "/etc/systemd/system/$app.service" systemctl enable $app.service +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= + +yunohost service add $app --log "/var/log/$app/$app.log" + #================================================= # RESTORE THE CRON FILE #================================================= @@ -139,5 +138,9 @@ ynh_restore_file "/etc/logrotate.d/$app" #systemctl reload php5-fpm systemctl reload nginx -systemctl restart "$app" +#================================================= +# START SERVICE +#================================================= + +yunohost service start $app diff --git a/scripts/upgrade b/scripts/upgrade index 31e2df8..daa376e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -72,6 +72,9 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +# Stop writefreely for upgrade +yunohost service stop "$app" + #================================================= # CHECK THE PATH #================================================= @@ -81,13 +84,6 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # STANDARD UPGRADE STEPS -#================================================= -# NGINX CONFIGURATION -#================================================= - -# Create a dedicated nginx config -ynh_add_nginx_config - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -95,6 +91,13 @@ ynh_add_nginx_config # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" +#================================================= +# NGINX CONFIGURATION +#================================================= + +# Create a dedicated nginx config +ynh_add_nginx_config + #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -166,4 +169,9 @@ fi #================================================= systemctl reload nginx -systemctl restart "$app" + +#================================================= +# START SERVICE +#================================================= + +yunohost service start $app