#!/bin/bash #================================================= # GENERIC START #================================================= # Import common cmd source ./experimental_helper.sh source ./_common.sh # IMPORT GENERIC HELPERS source /usr/share/yunohost/helpers # Exit if an error occurs during the execution of the script ynh_abort_if_errors # LOAD SETTINGS ynh_script_progression --message="Loading installation settings..." domain=$(ynh_app_setting_get --app $app --key domain) path_url=$(ynh_normalize_url_path --path_url $(ynh_app_setting_get --app $app --key path)) admin=$(ynh_app_setting_get --app $app --key admin) # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10 ynh_backup_before_upgrade # Backup the current version of the app ynh_clean_setup () { ynh_restore_upgradebackup # restore it if the upgrade fails } test -e /etc/uwsgi/apps-available/$app.ini && \ ynh_systemd_action --service_name "uwsgi-app@$app.service" --action stop #================================================= # STANDARD UPGRADE STEPS #================================================= # Install dependance ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $dependances # Download, check integrity, uncompress and patch the source from app.src ynh_script_progression --message="Upgrading source files..." --weight=6 install_source # CONFIGURE PGADMIN ynh_script_progression --message="Configuring application..." config_pgadmin # Config uwsgi ynh_add_uwsgi_service 'pgadmin_user python_version' # Create a dedicated nginx config ynh_add_nginx_config # Clean old uwsgi config ynh_secure_remove /etc/uwsgi/apps-enabled/pgadmin.ini #================================================= # GENERIC FINALIZATION #================================================= # Set permission after initialisation ynh_script_progression --message="Protecting directory..." set_permission # Configuration de logrotate ynh_script_progression --message="Configuring log rotation..." ynh_use_logrotate --logfile /var/log/pgadmin --nonappend # reload uwsgi ynh_script_progression --message="Restarting pgadmin services..." --weight=3 ynh_systemd_action --service_name "uwsgi-app@$app.service" \ --line_match "WSGI app 0 \(mountpoint='$path_url'\) ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/pgadmin.log" sleep 10 ynh_script_progression --message="Upgrade of $app completed" --last