From 6cd61ef35b14f935082059f007981d871caa1967 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 31 Aug 2021 16:08:23 +0200 Subject: [PATCH] Fix --- scripts/install | 15 ++++++++++----- scripts/restore | 40 +++++++++++++++++++--------------------- scripts/upgrade | 2 +- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/scripts/install b/scripts/install index a18f6be..3b1ccdf 100644 --- a/scripts/install +++ b/scripts/install @@ -169,7 +169,7 @@ yunohost service add $app --description="Nodejs Forum" --log="/var/log/$app/$app #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" #================================================= # SETUP SSOWAT @@ -193,15 +193,20 @@ ynh_systemd_action --service_name=nginx --action=reload #================================================= # SEND A README FOR THE ADMIN #================================================= +ynh_script_progression --message="Sending a readme for the admin..." --weight=1 -mail_content=$(cat $install_log | grep '\(Username\|Password\)')* +message="NodeBB was successfully installed :) -message=" $app was successfully installed :) Please open your $app domain: https://$domain$path_url -$mail_content +Complete the registration process from the setup page displayed. +Details for MySQL database to be enterted while registration process: -If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/nodebb_ynh" +Database login: $app +Database name: $app +Database password: $db_pwd + +If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/matomo_ynh/issues" ynh_send_readme_to_admin "$message" diff --git a/scripts/restore b/scripts/restore index 6dfb021..5c24bbf 100644 --- a/scripts/restore +++ b/scripts/restore @@ -71,23 +71,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# RESTORE THE MYSQL DATABASE -#================================================= - -pushd $final_path - datebackup=$(ynh_app_setting_get $app datebackup) - mongorestore mongo_backup$datebackup/ - ynh_secure_remove mongo_backup$datebackup/ -popd - -#================================================= -# ADVERTISE SERVICE IN ADMIN PANEL -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Nodejs Forum" --log="/var/log/$app/$app.log" - #================================================= # INSTALL NODEJS #================================================= @@ -98,12 +81,27 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= -# RESTORE SYSTEMD +# RESTORE THE POSTGRESQL DATABASE #================================================= +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6 -ynh_restore_file "/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet -systemctl start $app +ynh_psql_test_if_first_run +ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name + +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +yunohost service add $app --description="Nodejs Forum" --log="/var/log/$app/$app.log" + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index f395ebd..c38f91f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -156,7 +156,7 @@ yunohost service add $app --description="Nodejs Forum" --log="/var/log/$app/$app #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # RELOAD NGINX