From bf54dc39cbf5a00487bf2d9394fd00faaa745d44 Mon Sep 17 00:00:00 2001 From: oleole39 Date: Mon, 23 Jan 2023 05:06:09 +0100 Subject: [PATCH] Added workaround for ynh_psql_setup_db() forced password reset in YNH Core (bug?) and improved email sent to admin at install --- scripts/install | 29 +++++++++++++++++------------ scripts/restore | 8 ++++++++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/scripts/install b/scripts/install index 4751442..6d9c470 100755 --- a/scripts/install +++ b/scripts/install @@ -154,24 +154,29 @@ ynh_systemd_action --service_name=nginx --action=reload #================================================= ynh_script_progression --message="Sending a readme to the admin email address. Please check it to complete the installation process." -message="Noalyss installation is almost finished :) +message="Noalyss installation is *almost* complete :) -Please open the admin configuration page of your $app domain: https://$domain$path_url/install.php -From here, complete the registration process by: -1. Choosing language and clicking on \"Continuer\" (FR) / \"Continue\" (EN). +To conclude, please open the admin configuration page of your ${app^} domain: https://$domain$path_url/install.php +You will have to: +1. Choose the locale and click on \"Continuer\" (FR) / \"Continue\" (EN). 2. Scroll the page down and click on the button \"Commencer la mise à jour ou l\'installation ?\" (FR) / \"Start the update or the installation ?\" (EN) 3. Scroll to the bottom of the page and click on the button \"Essai effacement install.php et se connecter à NOALYSS\" (FR) / \"Try erasing install.php and log into NOALYSS\" (EN) -Once donce, you will be able to log into Noalyss with your credentials: -$app domain: https://$domain$path_url -$app admin user: $admin -$app admin password: $password +Once done, you will be able to log into Noalyss with your credentials: +------------------------------------------- +${app^}\'s domain: https://$domain$path_url +${app^}\'s admin user: $admin +${app^}\'s admin password: $password +------------------------------------------- +Link to Noalyss' user documentation: https://www.noalyss.eu/?page_id=1031 Please find also for reference the credential for the dedicated PostgreSQL database user: -Database dedicated user: $app -Database password: $db_pwd - -If you are facing any problem or want to improve this app, please open a new issue here or post a message in the forum" +------------------------------------------- +Database's dedicated user: $app +Database's 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/noalysse_ynh/issues +... Or post a message in the forum: https://forum.yunohost.org/t/noalyss-beligum-and-french-accounting/7356" ynh_send_readme_to_admin "$message" diff --git a/scripts/restore b/scripts/restore index 5d0ac21..795eda2 100755 --- a/scripts/restore +++ b/scripts/restore @@ -87,6 +87,14 @@ ynh_script_progression --message="Restoring the PostgreSQL database..." ynh_psql_restore_all_app_dbs_dumps --db_user=$db_user --db_user_pwd=db_user_pwd +# Give permission to db_user to create databases, as with version 9025 at least, standard Noalyss operation (can be tweaked with shared server install process - with potentially less features?) will require to create several databases: one admin database (account_repository), one database per accounting template (two are populated at install by default: mod1, mod2, etc.), one per accounting folder that will be created while using the app, etc. +if [ -n "$db_user" ]; then + sql="ALTER USER $db_user CREATEDB" + ynh_psql_execute_as_root --sql="$sql" + psql -c "ALTER USER noalyss WITH PASSWORD $db_user_pwd" #Workaround to restore the backed up password, since as of 23 January 2023, there seems to be a bug in ynh_psql_setup_db() helper (YNH Core) forcing password reset. + +fi + #================================================= # GENERIC FINALIZATION #=================================================