2024-01-30 11:37:53 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-01-31 16:08:58 +01:00
|
|
|
#=================================================
|
|
|
|
# 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
|
|
|
|
2018-01-31 16:08:58 +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
|
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 16:48:42 +01:00
|
|
|
ynh_install_venv() {
|
|
|
|
if [ -f "$install_dir/venv/bin/python" ]; then
|
|
|
|
ynh_exec_as "$app" python3 -m venv "$install_dir/venv" --upgrade
|
|
|
|
else
|
|
|
|
ynh_exec_as "$app" python3 -m venv "$install_dir/venv"
|
|
|
|
fi
|
|
|
|
ynh_use_venv
|
2024-01-30 15:32:09 +01:00
|
|
|
|
|
|
|
ynh_exec_as "$app" "$venvpy" -m pip install --upgrade --no-cache-dir pip wheel
|
2024-01-30 16:48:42 +01:00
|
|
|
}
|
|
|
|
ynh_use_venv() {
|
|
|
|
venvpy="$install_dir/venv/bin/python3"
|
|
|
|
}
|
|
|
|
|
|
|
|
_install_pgadmin_pip() {
|
2024-01-30 18:40:43 +01:00
|
|
|
# ynh_exec_as "$app" "$venvpy" -m pip install --upgrade --no-cache-dir --ignore-installed "psycopg[c]"
|
2024-01-30 15:32:09 +01:00
|
|
|
|
2024-01-30 22:50:25 +01:00
|
|
|
# cp "$YNH_APP_BASEDIR/conf/requirement_$(lsb_release --codename --short).txt" "$install_dir/requirements.txt"
|
2024-01-30 23:07:51 +01:00
|
|
|
# cp "$YNH_APP_BASEDIR/conf/requirements_orig.txt" "$install_dir/requirements.txt"
|
|
|
|
# ynh_exec_as "$app" "$venvpy" -m pip install --upgrade -r "$install_dir/requirements.txt"
|
|
|
|
ynh_exec_as "$app" "$venvpy" -m pip install --upgrade "pgadmin4==7.7"
|
2024-01-30 15:32:09 +01:00
|
|
|
}
|