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

Merge pull request #12 from YunoHost-Apps/v4.5

upgrade to 4.5 and fix install
This commit is contained in:
Josue-T 2021-04-05 11:59:47 +02:00 committed by GitHub
commit 5b3dcd1910
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 33 additions and 13 deletions

View file

@ -12,7 +12,7 @@ Overview
pgAdmin is a feature rich Open Source administration and development platform for PostgreSQL. pgAdmin is a feature rich Open Source administration and development platform for PostgreSQL.
**Shipped version:** 4-4.30 **Shipped version:** 4-5.1
Screenshots Screenshots
----------- -----------

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/Josue-T/pgadmin_python_build/releases/download/v4-4.30/pgadmin_4-4.30-stretch-bin1_armv7l.tar.gz SOURCE_URL=https://github.com/Josue-T/pgadmin_python_build/releases/download/v4-4.30/pgadmin_4-4.30-stretch-bin1_armv7l.tar.gz
SOURCE_SUM=60027354b5a3eeb968dd085bddab2e7670f8b4e7e1b1af1a4209e444dae684f4 SOURCE_SUM=17502fa77ba894d9c2d4b061485c30634f74dfd03031816af3b215feeec5cc45
# (Optional) Program to check the integrity (sha256sum, md5sum...) # (Optional) Program to check the integrity (sha256sum, md5sum...)
# default: sha256 # default: sha256
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/Josue-T/pgadmin_python_build/releases/download/v4-4.30/pgadmin_4-4.30-buster-bin1_armv7l.tar.gz SOURCE_URL=https://github.com/Josue-T/pgadmin_python_build/releases/download/v4-5.1/pgadmin_4-5.1-buster-bin1_armv7l.tar.gz
SOURCE_SUM=21ded86142bc8b1f126245a204c0db3ef3ff93405e745a2792288d478c878bf6 SOURCE_SUM=5fac31d2593a18d5c41448d312e5e8b7d127668bd6b4bd1ccfcd02411925b0db
# (Optional) Program to check the integrity (sha256sum, md5sum...) # (Optional) Program to check the integrity (sha256sum, md5sum...)
# default: sha256 # default: sha256
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum

View file

@ -6,7 +6,7 @@
"en": "Manage PostgreSQL databases over the web", "en": "Manage PostgreSQL databases over the web",
"fr": "Application web de gestion des bases de données PostgreSQL" "fr": "Application web de gestion des bases de données PostgreSQL"
}, },
"version": "4-4.30~ynh1", "version": "4-5.1~ynh1",
"url": "https://www.pgadmin.org", "url": "https://www.pgadmin.org",
"license": "PostgreSQL", "license": "PostgreSQL",
"maintainer": { "maintainer": {
@ -14,7 +14,7 @@
"email": "josue@tille.ch" "email": "josue@tille.ch"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.8.0.0" "yunohost": ">= 4.0.0.0"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [

View file

@ -6,7 +6,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=/opt/yunohost/$app final_path=/opt/yunohost/$app
pgadmin_user="$app" pgadmin_user="$app"
python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)" python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)"
dependances="python3-pip build-essential python3-dev python3-venv postgresql uwsgi uwsgi-plugin-python3 expect libpq-dev" dependances="python3-pip build-essential python3-dev python3-venv postgresql uwsgi uwsgi-plugin-python3 expect libpq-dev libkrb5-dev"
#================================================= #=================================================
# DEFINE ALL COMMON FONCTIONS # DEFINE ALL COMMON FONCTIONS
@ -22,10 +22,16 @@ setup_dir() {
install_source() { install_source() {
# Clean venv is it was on python with an old version in case major upgrade of debian # Clean venv is it was on python with an old version in case major upgrade of debian
if [ ! -e $final_path/lib/python$python_version ]; then if [ ! -e $final_path/lib/python$python_version ]; then
ynh_secure_remove --file=$final_path ynh_secure_remove --file=$final_path/bin
ynh_secure_remove --file=$final_path/lib
ynh_secure_remove --file=$final_path/lib64
ynh_secure_remove --file=$final_path/include
ynh_secure_remove --file=$final_path/share
ynh_secure_remove --file=$final_path/pyvenv.cfg
fi fi
mkdir -p $final_path mkdir -p $final_path
chown $pgadmin_user:root -R $final_path
if [ -n "$(uname -m | grep arm)" ] if [ -n "$(uname -m | grep arm)" ]
then then
@ -36,19 +42,29 @@ install_source() {
ynh_secure_remove --file=$final_path/share ynh_secure_remove --file=$final_path/share
ynh_setup_source --dest_dir $final_path/ --source_id "armv7_$(lsb_release --codename --short)" ynh_setup_source --dest_dir $final_path/ --source_id "armv7_$(lsb_release --codename --short)"
else else
# Install rustup is not already installed
# We need this to be able to install cryptgraphy
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
if [ -e $final_path/.rustup ]; then
sudo -u "$pgadmin_user" env PATH=$PATH rustup update
else
sudo -u "$pgadmin_user" bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=stable --profile=minimal'
fi
# Install virtualenv if it don't exist # Install virtualenv if it don't exist
test -e $final_path/bin/python3 || python3 -m venv $final_path test -e $final_path/bin/python3 || python3 -m venv $final_path
# Install pgadmin in virtualenv # Install pgadmin in virtualenv
set +u; u_arg='u'
set +$u_arg;
source $final_path/bin/activate source $final_path/bin/activate
set -u; set -u;
pip3 install --upgrade pip pip3 install --upgrade pip
pip3 install --upgrade 'Werkzeug<1.0' pip3 install --upgrade 'Werkzeug<1.0'
pip3 install --upgrade pgadmin$app_main_version==$app_sub_version pip3 install --upgrade pgadmin$app_main_version==$app_sub_version
set +u; set +$u_arg;
deactivate deactivate
set -u; set -$u_arg;
fi fi
} }

View file

@ -63,7 +63,7 @@ ynh_install_app_dependencies $dependances
# Create user # Create user
ynh_script_progression --message="Configuring system user..." ynh_script_progression --message="Configuring system user..."
ynh_system_user_create --username $pgadmin_user --home_dir /var/lib/$app ynh_system_user_create --username $pgadmin_user --home_dir $final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_script_progression --message="Installing sources files..." --weight=10 ynh_script_progression --message="Installing sources files..." --weight=10

View file

@ -37,7 +37,7 @@ ynh_install_app_dependencies $dependances
# Create user # Create user
ynh_script_progression --message="Recreating the dedicated system user..." ynh_script_progression --message="Recreating the dedicated system user..."
ynh_system_user_create --username $pgadmin_user --home_dir /var/lib/$app ynh_system_user_create --username $pgadmin_user --home_dir $final_path
# Restore all config and data # Restore all config and data
ynh_script_progression --message="Restoring files..." --weight=5 ynh_script_progression --message="Restoring files..." --weight=5

View file

@ -33,6 +33,10 @@ ynh_clean_setup () {
test -e /etc/uwsgi/apps-available/$app.ini && \ test -e /etc/uwsgi/apps-available/$app.ini && \
ynh_systemd_action --service_name "uwsgi-app@$app.service" --action stop ynh_systemd_action --service_name "uwsgi-app@$app.service" --action stop
if ! grep -q "$final_path" /etc/passwd; then
sed --in-place -r "s@$app\:x\:([[:digit:]]+\:[[:digit:]]+)\:\:/.*/$app\:/usr/sbin/nologin@$app\:x\:\1\:\:$final_path\:/usr/sbin/nologin@g" /etc/passwd
fi
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================