From 34a539c61818041da0ebf267cbed046c40d95913 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 28 Nov 2020 11:36:27 +0100 Subject: [PATCH] Fix --- scripts/remove | 7 +++---- scripts/restore | 28 ++++++++++++---------------- scripts/upgrade | 6 ++++++ 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/scripts/remove b/scripts/remove index 5161b95..8aa1549 100755 --- a/scripts/remove +++ b/scripts/remove @@ -16,11 +16,10 @@ ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -port=$(ynh_app_setting_get $app port) -db_name=$(ynh_app_setting_get $app db_name) +domain=$(ynh_app_setting_get --app=$app --key=domain) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name -final_path=$(ynh_app_setting_get $app final_path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #===============#================================== # STANDARD REMOVE diff --git a/scripts/restore b/scripts/restore index 4cd0abf..736e3c7 100755 --- a/scripts/restore +++ b/scripts/restore @@ -13,11 +13,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= @@ -27,15 +22,16 @@ ynh_print_info "Loading settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -final_path=$(ynh_app_setting_get $app final_path) -db_name=$(ynh_app_setting_get $app db_name) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info "Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -53,14 +49,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info "Restoring the app main directory..." +ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file "$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info "Recreating the dedicated system user..." +ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create $app @@ -83,7 +79,7 @@ ynh_restore_file "/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_print_info "Reinstalling dependencies..." +ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies @@ -91,7 +87,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE POSTGRES DATABASE #================================================= -ynh_print_info "Restoring the Postgres database..." +ynh_script_progression --message="Restoring the Postgres database..." db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_psql_test_if_first_run @@ -109,7 +105,7 @@ yunohost service add $app --log "/var/log/$app/$app.log" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_print_info "Reloading nginx web server and PHP-FPM..." +ynh_script_progression --message="Reloading nginx web server and PHP-FPM..." systemctl reload php$phpversion-fpm systemctl reload nginx @@ -118,4 +114,4 @@ systemctl reload nginx # END OF SCRIPT #================================================= -ynh_print_info "Restoration completed for $app" +ynh_script_progression --message="Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index d2df90a..22ee326 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -135,6 +135,12 @@ ynh_add_fpm_config --package="$extra_php_dependencies" chown -R $app: $final_path chown $app: $final_path/include/constant.php +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= + +yunohost service add $app --description "Accounting free software" --log "/var/log/$app/$app.log" + #================================================= # SETUP APPLICATION WITH CURL #=================================================