From 61ab52989740c1767cfabb21315d136bc8689bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 31 Jan 2024 14:44:14 +0100 Subject: [PATCH] reorder steps --- scripts/restore | 14 +++++++------- scripts/upgrade | 14 ++++++++------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/scripts/restore b/scripts/restore index 9870e27..8fed89b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -11,6 +11,13 @@ source ../settings/scripts/experimental_helper.sh source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers +#================================================= +# RESTORE THE POSTGRESQL SUPERUSER +#================================================= +ynh_script_progression --message="Restoring the Postgresql superuser..." --weight=1 + +ynh_psql_execute_as_root --sql "ALTER USER $app WITH SUPERUSER CREATEDB CREATEROLE REPLICATION" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -23,13 +30,6 @@ ynh_restore_file --origin_path="$install_dir" ### ownership to all files such as after the ynh_setup_source step chown -R "$app:www-data" "$install_dir" -#================================================= -# RESTORE THE POSTGRESQL SUPERUSER -#================================================= -ynh_script_progression --message="Restoring the Postgresql superuser..." --weight=1 -password=$(cat hashed_password.txt) -ynh_psql_execute_as_root --sql "ALTER USER $app WITH PASSWORD '$password' SUPERUSER CREATEDB CREATEROLE REPLICATION" - #================================================= # REINSTALL DEPENDENCIES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 963605d..8d83eaa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -32,6 +32,14 @@ usermod -d "$install_dir" "$app" # Clean old uwsgi config ynh_secure_remove /etc/uwsgi/apps-enabled/pgadmin.ini +#================================================= +# Postgresql superuser +#================================================= +ynh_script_progression --message="Configuring Postgresql superuser..." + +# Re-set the db_pwd just in caseā€¦ +ynh_psql_execute_as_root --sql "ALTER USER $app WITH PASSWORD '$db_pwd' SUPERUSER CREATEDB CREATEROLE REPLICATION" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -52,12 +60,6 @@ ynh_add_config --template="config_local.py" --destination="$install_dir/venv/lib set_permission -#================================================= -# Postgresql superuser -#================================================= -ynh_script_progression --message="Configuring Postgresql superuser..." -ynh_psql_execute_as_root --sql "ALTER USER $app WITH SUPERUSER CREATEDB CREATEROLE REPLICATION" - #================================================= # REAPPLY SYSTEM CONFIGURATIONS #=================================================