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

43 lines
1.4 KiB
Bash
Raw Normal View History

2024-01-30 11:37:53 +01:00
#!/usr/bin/env bash
#=================================================
# SET ALL CONSTANTS
#=================================================
2020-04-20 15:32:01 +02:00
python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)"
2022-03-13 15:22:35 +01:00
#=================================================
# DEFINE ALL COMMON FONCTIONS
#=================================================
2017-11-16 21:10:21 +01:00
setup_dir() {
# Create empty dir for pgadmin
mkdir -p /var/lib/pgadmin
mkdir -p /var/log/pgadmin
}
2017-11-14 16:05:26 +01:00
2017-11-16 21:10:21 +01:00
set_permission() {
# Set permission
2024-01-30 11:36:14 +01:00
chown $app:root -R $install_dir
chown $app:root -R /var/lib/pgadmin
2022-03-19 12:19:38 +01:00
mkdir -p /var/log/pgadmin
2024-01-30 11:36:14 +01:00
chown $app:root -R /var/log/pgadmin
chown $app:root /var/log/uwsgi/$app
chown $app:root /etc/uwsgi/apps-available/$app.ini
2018-01-29 18:48:14 +01:00
chmod u=rwX,g=rX,o= -R /var/lib/pgadmin
2017-11-16 21:10:21 +01:00
}
2017-11-14 16:05:26 +01:00
2024-01-30 15:32:09 +01:00
_install_pgadmin_venv() {
ynh_exec_as "$app" python3 -m venv --upgrade "$install_dir/venv"
venvpy="$install_dir/venv/bin/python3"
ynh_exec_as "$app" "$venvpy" -m pip install --upgrade --no-cache-dir pip wheel
ynh_exec_as "$app" "$venvpy" -m pip install --upgrade --no-cache-dir --ignore-installed "psycopg[c]"
ynh_exec_as "$app" "$venvpy" -m pip install --upgrade -r "$YNH_APP_BASEDIR/conf/requirement_$(lsb_release --codename --short).txt"
}
2017-11-16 21:10:21 +01:00
config_pgadmin() {
2024-01-30 15:32:09 +01:00
ynh_add_config --template="config_local.py" --destination="$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/config_local.py"
2017-11-16 21:10:21 +01:00
}