1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pgadmin_ynh.git synced 2024-09-03 19:56:38 +02:00

Move /var/lib/pgadmin to install_dir/data

This commit is contained in:
Félix Piédallu 2024-01-31 16:41:58 +01:00
parent 92c9fffbd9
commit 466207902b
6 changed files with 11 additions and 17 deletions

View file

@ -1,3 +1,5 @@
#!/usr/bin/env python3
DESKTOP_USER = '__APP__@__DOMAIN__'
DATA_DIR = '__INSTALL_DIR__/data'

View file

@ -36,8 +36,6 @@ ynh_backup --src_path="/etc/uwsgi/apps-available/$app.ini"
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/var/lib/pgadmin"
# Backup hashed password
ynh_psql_execute_as_root --sql="SELECT rolpassword FROM pg_authid WHERE rolname='$app';" | head -3 | tail -1 > hashed_password.txt

View file

@ -31,13 +31,10 @@ ynh_script_progression --message="Setting up source files..."
ynh_install_venv
_install_pgadmin_pip
mkdir -p "$install_dir/data"
chown -R "$app:root" "$install_dir"
mkdir -p /var/lib/pgadmin
chmod -R 750 /var/lib/pgadmin
chown -R "$app:root" /var/lib/pgadmin
mkdir -p /var/log/pgadmin
chown -R "$app:root" /var/log/pgadmin

View file

@ -34,9 +34,6 @@ ynh_remove_nginx_config
#=================================================
ynh_script_progression --message="Removing various files..."
# Remove app data
ynh_secure_remove --file="/var/lib/$app"
# Remove the log files
ynh_secure_remove --file="/var/log/$app"

View file

@ -50,10 +50,6 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/var/lib/pgadmin"
chmod -R 750 /var/lib/pgadmin
chown -R "$app:root" /var/lib/pgadmin
ynh_restore_file --origin_path="/var/log/$app/"
chmod -R 750 /var/log/pgadmin
chown -R "$app:root" /var/log/pgadmin

View file

@ -32,6 +32,14 @@ usermod -d "$install_dir" "$app"
# Clean old uwsgi config
ynh_secure_remove /etc/uwsgi/apps-enabled/pgadmin.ini
if [ -d "/var/lib/pgadmin" ]; then
if [ ! -d "$install_dir/data" ]; then
mv "/var/lib/pgadmin" "$install_dir/data"
fi
ynh_secure_remove "/var/lib/pgadmin"
fi
#=================================================
# Postgresql superuser
#=================================================
@ -50,10 +58,6 @@ _install_pgadmin_pip
chown -R "$app:root" "$install_dir"
mkdir -p /var/lib/pgadmin
chmod -R 750 /var/lib/pgadmin
chown -R "$app:root" /var/lib/pgadmin
#=================================================
# UPDATE A CONFIG FILE
#=================================================