diff --git a/README.md b/README.md index c19b30a..69134c8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ pgAdmin for yunohost ==================== [![Integration level](https://dash.yunohost.org/integration/pgadmin.svg)](https://dash.yunohost.org/appci/app/pgadmin) ![](https://ci-apps.yunohost.org/ci/badges/pgadmin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/pgadmin.maintain.svg) -[![Install pgadmin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=pgadmin) +[![Install pgadmin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=pgadmin) > *This package allow you to install pgadmin quickly and simply on a YunoHost server. If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* @@ -12,7 +12,7 @@ Overview pgAdmin is a feature rich Open Source administration and development platform for PostgreSQL. -**Shipped version:** 4-4.28 +**Shipped version:** 4-5.1 Screenshots ----------- diff --git a/conf/armv7_stretch.src b/conf/armv7_bullseye.src similarity index 71% rename from conf/armv7_stretch.src rename to conf/armv7_bullseye.src index 5fc1e3d..2943e78 100644 --- a/conf/armv7_stretch.src +++ b/conf/armv7_bullseye.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Josue-T/pgadmin_python_build/releases/download/v4-4.28/pgadmin_4-4.28-stretch-bin1_armv7l.tar.gz -SOURCE_SUM=f9c786137c9f401e20f738737c12c02ae4f8d645b80544c78752ecba1a5f280d +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=17502fa77ba894d9c2d4b061485c30634f74dfd03031816af3b215feeec5cc45 # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/conf/armv7_buster.src b/conf/armv7_buster.src index b58682b..3cc7195 100644 --- a/conf/armv7_buster.src +++ b/conf/armv7_buster.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Josue-T/pgadmin_python_build/releases/download/v4-4.28/pgadmin_4-4.28-buster-bin1_armv7l.tar.gz -SOURCE_SUM=631919aadf076649365df7040c0b51fb5c8aaf45c9770613a38ccb392caea39a +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=5fac31d2593a18d5c41448d312e5e8b7d127668bd6b4bd1ccfcd02411925b0db # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/manifest.json b/manifest.json index 0efa007..1729d82 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Manage PostgreSQL databases over the web", "fr": "Application web de gestion des bases de données PostgreSQL" }, - "version": "4-4.28~ynh1", + "version": "4-5.1~ynh1", "url": "https://www.pgadmin.org", "license": "PostgreSQL", "maintainer": { @@ -14,7 +14,7 @@ "email": "josue@tille.ch" }, "requirements": { - "yunohost": ">= 3.8.0.0" + "yunohost": ">= 4.0.0.0" }, "multi_instance": false, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 59afd95..67989ea 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=/opt/yunohost/$app pgadmin_user="$app" 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 @@ -22,10 +22,16 @@ setup_dir() { install_source() { # 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 - 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 mkdir -p $final_path + chown $pgadmin_user:root -R $final_path if [ -n "$(uname -m | grep arm)" ] then @@ -36,19 +42,29 @@ install_source() { ynh_secure_remove --file=$final_path/share ynh_setup_source --dest_dir $final_path/ --source_id "armv7_$(lsb_release --codename --short)" 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 test -e $final_path/bin/python3 || python3 -m venv $final_path # Install pgadmin in virtualenv - set +u; + u_arg='u' + set +$u_arg; source $final_path/bin/activate set -u; pip3 install --upgrade pip pip3 install --upgrade 'Werkzeug<1.0' pip3 install --upgrade pgadmin$app_main_version==$app_sub_version - set +u; + set +$u_arg; deactivate - set -u; + set -$u_arg; fi } diff --git a/scripts/backup b/scripts/backup index 52ff421..0630790 100644 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers ynh_abort_if_errors # LOAD SETTINGS -ynh_script_progression --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." final_path=$(ynh_app_setting_get --app $app --key final_path) domain=$(ynh_app_setting_get --app $app --key domain) db_name=$(ynh_app_setting_get --app $app --key db_name) @@ -28,20 +28,20 @@ app_sub_version=$(echo $app_version | cut -d'-' -f2) #================================================= # BACKUP THE APP MAIN DIR -ynh_script_progression --message="Backing up the main app directory..." +ynh_print_info --message="Backing up the main app directory..." ynh_backup --src_path "$final_path" # Backup config -ynh_script_progression --message="Backing configuration..." +ynh_print_info --message="Backing configuration..." ynh_backup --src_path "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path "/etc/uwsgi/apps-available/$app.ini" # Backup Data and LOG -ynh_script_progression --message="Backing up data..." +ynh_print_info --message="Backing up data..." ynh_backup --src_path "/var/lib/pgadmin" -ynh_script_progression --message="Backing up log..." +ynh_print_info --message="Backing up log..." ynh_backup --src_path "/var/log/pgadmin" ynh_backup --src_path "/var/log/uwsgi/$app" -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/experimental_helper.sh b/scripts/experimental_helper.sh index 3b75020..6b09bfc 100644 --- a/scripts/experimental_helper.sh +++ b/scripts/experimental_helper.sh @@ -128,6 +128,11 @@ ynh_remove_uwsgi_service () { fi } +ynh_restore_uwsgi_service () { + ynh_check_global_uwsgi_config + systemctl enable "uwsgi-app@$app" --quiet + yunohost service add "uwsgi-app@$app" --log "/var/log/uwsgi/$app/$app.log" +} #================================================= # OTHERS HELPERS diff --git a/scripts/install b/scripts/install index d9f0cc8..4254391 100644 --- a/scripts/install +++ b/scripts/install @@ -18,7 +18,7 @@ ynh_script_progression --message="Validating installation parameters..." # RETRIEVE ARGUMENTS FROM THE MANIFEST domain=$YNH_APP_ARG_DOMAIN -path_url=$(ynh_normalize_url_path --path_url $YNH_APP_ARG_PATH) +path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN db_user="pgadmin" admin_pwd=$YNH_APP_ARG_ADMIN_PASSWORD @@ -63,7 +63,7 @@ ynh_install_app_dependencies $dependances # Create 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 ynh_script_progression --message="Installing sources files..." --weight=10 diff --git a/scripts/restore b/scripts/restore index d9621c6..ea2f953 100644 --- a/scripts/restore +++ b/scripts/restore @@ -37,7 +37,7 @@ ynh_install_app_dependencies $dependances # Create 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 ynh_script_progression --message="Restoring files..." --weight=5 @@ -55,8 +55,7 @@ ynh_psql_execute_as_root \ # Restore systemd configuration ynh_script_progression --message="Reconfiguring application..." -ynh_check_global_uwsgi_config -systemctl enable "uwsgi-app@$app.service" +ynh_restore_uwsgi_service #================================================= # GENERIC FINALIZATION @@ -67,8 +66,8 @@ ynh_script_progression --message="Protecting directory..." set_permission # Restrict access to admin only -ynh_script_progression --message="Configuring permissions..." -yunohost app addaccess --users=$admin $app +ynh_script_progression --message="Configuring permissions" +ynh_permission_update --permission="main" --remove="all_users" --add=$admin # Configuration de logrotate ynh_script_progression --message="Configuring log rotation..." diff --git a/scripts/upgrade b/scripts/upgrade index 5013c0d..495b2d7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,6 +33,10 @@ ynh_clean_setup () { test -e /etc/uwsgi/apps-available/$app.ini && \ 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 #=================================================