mirror of
https://github.com/YunoHost-Apps/pgadmin_ynh.git
synced 2024-09-03 19:56:38 +02:00
handle psql user differently
This commit is contained in:
parent
13e7fe0dd1
commit
1838024e42
5 changed files with 6 additions and 15 deletions
|
@ -67,5 +67,5 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
|
||||||
[resources.apt]
|
[resources.apt]
|
||||||
packages = "python3-pip, build-essential, python3-dev, python3-venv, postgresql, uwsgi, uwsgi-plugin-python3, expect, libpq-dev, libkrb5-dev"
|
packages = "python3-pip, build-essential, python3-dev, python3-venv, postgresql, uwsgi, uwsgi-plugin-python3, expect, libpq-dev, libkrb5-dev"
|
||||||
|
|
||||||
# [resources.database]
|
[resources.database]
|
||||||
# type = "postgresql"
|
type = "postgresql"
|
||||||
|
|
|
@ -44,7 +44,7 @@ chmod +x "$install_dir/setup.exp"
|
||||||
# Postgresql superuser
|
# Postgresql superuser
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring Postgresql superuser..."
|
ynh_script_progression --message="Configuring Postgresql superuser..."
|
||||||
ynh_psql_execute_as_root --sql "CREATE USER $db_user WITH PASSWORD '$db_pwd' SUPERUSER CREATEDB CREATEROLE REPLICATION"
|
ynh_psql_execute_as_root --sql "ALTER USER $app WITH SUPERUSER CREATEDB CREATEROLE REPLICATION"
|
||||||
|
|
||||||
# Add Server In PGadmin database
|
# Add Server In PGadmin database
|
||||||
ynh_add_config --template="setup_database.py" --destination "$install_dir/setup_database.py"
|
ynh_add_config --template="setup_database.py" --destination "$install_dir/setup_database.py"
|
||||||
|
|
|
@ -27,13 +27,6 @@ ynh_remove_logrotate
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CONFIGURE POSTGRESQL
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the Postgresql superuser..."
|
|
||||||
|
|
||||||
ynh_psql_drop_user "$db_user"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -27,8 +27,7 @@ chown -R "$app:www-data" "$install_dir"
|
||||||
# RESTORE THE POSTGRESQL SUPERUSER
|
# RESTORE THE POSTGRESQL SUPERUSER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the Postgresql superuser..." --weight=1
|
ynh_script_progression --message="Restoring the Postgresql superuser..." --weight=1
|
||||||
|
ynh_psql_execute_as_root --sql "ALTER USER $db_user WITH SUPERUSER CREATEDB CREATEROLE REPLICATION"
|
||||||
ynh_psql_execute_as_root --sql "CREATE USER $db_user WITH PASSWORD '$db_pwd' SUPERUSER CREATEDB CREATEROLE REPLICATION"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
|
|
|
@ -26,9 +26,8 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||||
|
|
||||||
if ! grep -q "$install_dir" /etc/passwd; then
|
# Set the proper home directory
|
||||||
sed --in-place -r "s@$app\:x\:([[:digit:]]+\:[[:digit:]]+)\:\:/.*/$app\:/usr/sbin/nologin@$app\:x\:\1\:\:$install_dir\:/usr/sbin/nologin@g" /etc/passwd
|
usermod -d "$install_dir" "$app"
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean old uwsgi config
|
# Clean old uwsgi config
|
||||||
ynh_secure_remove /etc/uwsgi/apps-enabled/pgadmin.ini
|
ynh_secure_remove /etc/uwsgi/apps-enabled/pgadmin.ini
|
||||||
|
|
Loading…
Add table
Reference in a new issue