From 670a55b6328dda7632b3913c85e1808e2dd4f8f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 31 Jan 2024 12:17:37 +0100 Subject: [PATCH] do not overwrite db_pwd --- conf/setup.exp | 3 +-- scripts/install | 9 +++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/setup.exp b/conf/setup.exp index 26efb02..5c67097 100755 --- a/conf/setup.exp +++ b/conf/setup.exp @@ -3,12 +3,11 @@ set timeout 20 set cmd [lindex $argv 0] set path [lindex $argv 1] -set user [lindex $argv 2] spawn $cmd $path expect "Email address:" -send "$user\r"; +send "__EMAIL__\r"; expect "Password:" send {__PASSWORD__}; diff --git a/scripts/install b/scripts/install index 7b815e0..ceabbcb 100644 --- a/scripts/install +++ b/scripts/install @@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers # INITIALIZE AND STORE SETTINGS #================================================= +# Used in expect script email=$(ynh_user_get_info --username $admin --key 'mail') #================================================= @@ -38,19 +39,19 @@ ynh_script_progression --message="Configuring $app..." ynh_add_config --template="setup.exp" --destination="$install_dir/setup.exp" chmod +x "$install_dir/setup.exp" -"$install_dir/setup.exp" "$install_dir/venv/bin/python3" "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/setup.py" "$email" +"$install_dir/setup.exp" "$install_dir/venv/bin/python3" "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/setup.py" #================================================= # Postgresql superuser #================================================= ynh_script_progression --message="Configuring Postgresql superuser..." -# We overwrite the existing db_pwd -ynh_psql_execute_as_root --sql "ALTER USER $app WITH PASSWORD '$password' SUPERUSER CREATEDB CREATEROLE REPLICATION" + +ynh_psql_execute_as_root --sql "ALTER USER $app WITH SUPERUSER CREATEDB CREATEROLE REPLICATION" # Add Server In PGadmin database ynh_add_config --template="setup_database.py" --destination "$install_dir/setup_database.py" chmod +x "$install_dir/setup_database.py" -"$install_dir/venv/bin/python3" "$install_dir/setup_database.py" "$db_user" "$password" +"$install_dir/venv/bin/python3" "$install_dir/setup_database.py" "$db_user" "$db_pwd" # Set permission after initialisation ynh_script_progression --message="Protecting directory"