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"