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

Add script progression weights

This commit is contained in:
Salamandar 2024-01-31 19:46:18 +01:00
parent 2896c49a91
commit 4ea1a2262e
5 changed files with 11 additions and 12 deletions

View file

@ -23,7 +23,7 @@ ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="stop" --log
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..."
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_change_url_nginx_config
@ -32,7 +32,7 @@ ynh_change_url_nginx_config
#=================================================
# UPDATE CONFIGURATION
#=================================================
ynh_script_progression --message="Updating configuration..."
ynh_script_progression --message="Updating configuration..." --weight=1
# Update UWSGI Config
ynh_add_uwsgi_service "python_version"

View file

@ -20,14 +20,14 @@ email=$(ynh_user_get_info --username $admin --key 'mail')
#=================================================
# Postgresql superuser
#=================================================
ynh_script_progression --message="Configuring Postgresql superuser..."
ynh_script_progression --message="Configuring Postgresql superuser..." --weight 1
ynh_psql_execute_as_root --sql "ALTER USER $db_user WITH SUPERUSER CREATEDB CREATEROLE REPLICATION"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_script_progression --message="Setting up source files..." --weight=5
ynh_install_venv
_install_pgadmin_pip
@ -46,7 +46,7 @@ ynh_script_progression --message="Configuring pgAdmin..." --weight=1
ynh_add_config --template="config_local.py" --destination="$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/config_local.py"
chown -R "$app:root" "$install_dir"
ynh_add_config --template="setup.exp" --destination="$install_dir/setup.exp"
ynh_add_config --template="setup.exp" --destination="$install_dir/setup.exp" --weight=2
chmod +x "$install_dir/setup.exp"
ynh_exec_as "$app" "$install_dir/setup.exp" "$install_dir/venv/bin/python3" "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/setup.py" setup-db

View file

@ -32,7 +32,7 @@ ynh_remove_nginx_config
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
ynh_script_progression --message="Removing various files..." --weight=1
# Remove the log files
ynh_secure_remove --file="/var/log/$app"

View file

@ -48,7 +48,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_script_progression --message="Restoring various files..." --weight=1
ynh_restore_file --origin_path="/var/log/$app/"
chmod -R 750 /var/log/pgadmin
@ -56,7 +56,7 @@ chown -R "$app:root" /var/log/pgadmin
# Restore systemd configuration
ynh_script_progression --message="Reconfiguring application..."
ynh_script_progression --message="Reconfiguring application..." --weight=1
ynh_restore_uwsgi_service
#=================================================

View file

@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_script_progression --message="Stopping a systemd service..." --weight=1
if [ -f "/etc/uwsgi/apps-available/$app.ini" ]; then
ynh_systemd_action --service_name "uwsgi-app@$app.service" --action stop
@ -24,7 +24,7 @@ fi
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
# Set the proper home directory
usermod -d "$install_dir" "$app"
@ -39,11 +39,10 @@ if [ -d "/var/lib/pgadmin" ]; then
ynh_secure_remove "/var/lib/pgadmin"
fi
#=================================================
# Postgresql superuser
#=================================================
ynh_script_progression --message="Configuring Postgresql superuser..."
ynh_script_progression --message="Configuring Postgresql superuser..." --weight=1
# Re-set the db_pwd just in case…
ynh_psql_execute_as_root --sql "ALTER USER $app WITH PASSWORD '$db_pwd' SUPERUSER CREATEDB CREATEROLE REPLICATION"