1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kresus_ynh.git synced 2024-09-03 19:36:10 +02:00

Add progression messages (fix #62)

This commit is contained in:
nicofrand 2020-05-03 14:03:03 +02:00
parent 3d867f8ce6
commit ee319ebdfe
4 changed files with 41 additions and 6 deletions

View file

@ -30,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..."
architecture=$(ynh_detect_arch)
# Check machine architecture (in particular, we don't support ARM and 32bit machines)
@ -72,6 +73,7 @@ ynh_app_setting_set "$app" salt "$salt"
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing app dependencies"
ynh_install_app_dependencies $pkg_dependencies
#=================================================
@ -81,6 +83,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_app_setting_set "$app" final_path "$final_path"
# Download, check integrity, uncompress and patch the source from app.src
ynh_script_progression --message="Dowloading app from sources"
ynh_setup_source "$final_path"
mkdir "$final_path/data"
@ -101,22 +104,23 @@ ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
# CREATE DEDICATED USER
#=================================================
# Create a system user
ynh_script_progression --message="Creating system user"
ynh_system_user_create "$app"
#=================================================
# SPECIFIC SETUP
#=================================================
# Install nodesjs
# Install nodejs
#=================================================
# install nodejs
ynh_script_progression --message="Installing nodejs"
ynh_install_nodejs 12
#=================================================
# Install weboob with pip
#=================================================
ynh_script_progression --message="Installing weboob"
virtualenv --python=python3 --system-site-packages "${final_path}/venv"
(
set +o nounset
@ -131,6 +135,7 @@ virtualenv --python=python3 --system-site-packages "${final_path}/venv"
# Install Kresus with npm
#=================================================
ynh_script_progression --message="Installing app"
ynh_use_nodejs
(
cd "$final_path"
@ -145,6 +150,7 @@ ynh_use_nodejs
db_name="$app"
db_user="$app"
ynh_script_progression --message="Setting up database"
ynh_psql_test_if_first_run
ynh_psql_setup_db "$db_user" "$db_name"
db_pwd=$(ynh_app_setting_get "$app" psqlpwd)
@ -178,6 +184,7 @@ ynh_replace_string "__ENV_PATH__" "$PATH" ../conf/systemd.se
ynh_replace_string "__NODEPATH__" "$(dirname "$nodejs_path")" ../conf/systemd.service
# Create a dedicated systemd config
ynh_script_progression --message="Creating systemd configuration"
ynh_add_systemd_config
#=================================================
@ -199,6 +206,7 @@ chmod 600 "$final_path/config.ini"
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx"
service "$app" start
service nginx reload
@ -221,3 +229,5 @@ Are you facing an issue, want to improve this app or say thank you?
Please open a new issue in this project: https://github.com/YunoHost-Apps/kresus_ynh
"
ynh_send_readme_to_admin "$message"
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -28,6 +28,7 @@ db_user="$app"
#=================================================
# Remove the dedicated systemd config
ynh_script_progression --message="Removing systemd configuration"
ynh_remove_systemd_config
#=================================================
@ -35,6 +36,7 @@ ynh_remove_systemd_config
#=================================================
# Remove a database if it exists, along with the associated user
ynh_script_progression --message="Removing associated database"
ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name"
#=================================================
@ -42,6 +44,7 @@ ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name"
#=================================================
# Remove metapackage and its dependencies
ynh_script_progression --message="Removing dependencies"
ynh_remove_app_dependencies
ynh_remove_nodejs
@ -57,6 +60,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
# Remove the dedicated nginx config
ynh_script_progression --message="Removing nginx configuration"
ynh_remove_nginx_config
#=================================================
@ -66,4 +70,7 @@ ynh_remove_nginx_config
#=================================================
# Delete a system user
ynh_script_progression --message="Deleting system user"
ynh_system_user_delete "$app"
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -60,6 +60,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring files"
ynh_restore_file "$final_path"
#=================================================
@ -67,6 +68,7 @@ ynh_restore_file "$final_path"
#=================================================
# Create the dedicated user (if not existing)
ynh_script_progression --message="Creating system user"
ynh_system_user_create "$app"
#=================================================
@ -83,19 +85,21 @@ chmod 600 "$final_path/config.ini"
# REINSTALL DEPENDENCIES
#=================================================
# Define and install dependencies
ynh_script_progression --message="Installing app dependencies"
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing nodejs"
ynh_install_nodejs 12
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Restoring database"
ynh_psql_test_if_first_run
ynh_print_OFF
ynh_psql_setup_db "$db_user" "$db_name" "$db_pwd"
@ -113,6 +117,7 @@ systemctl enable "$app".service
# START KRESUS
#=================================================
ynh_script_progression --message="Starting application"
systemctl start "$app"
#=================================================
@ -121,4 +126,7 @@ systemctl start "$app"
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading nginx"
systemctl reload nginx
ynh_script_progression --message="Restoration of $app completed" --last

View file

@ -52,6 +52,7 @@ fi
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app"
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
@ -75,10 +76,12 @@ path_url=$(ynh_normalize_url_path "$path_url")
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing app dependencies"
ynh_install_app_dependencies $pkg_dependencies
# Now that postgresql is installed, check the db exists and the user is set up
ynh_script_progression --message="Setting up database"
if [ -z "$db_pwd" ]; then
ynh_psql_test_if_first_run
ynh_psql_setup_db "$db_user" "$db_name"
@ -90,6 +93,7 @@ fi
#=================================================
# Download, check integrity, uncompress and patch the source from app.src
ynh_script_progression --message="Dowloading app from sources"
ynh_setup_source "$final_path"
mkdir -p "$final_path/data"
@ -109,7 +113,7 @@ ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
# CREATE DEDICATED USER
#=================================================
# Create a system user
ynh_script_progression --message="Creating system user"
ynh_system_user_create "$app"
@ -119,13 +123,14 @@ ynh_system_user_create "$app"
# Install nodesjs
#=================================================
# install nodejs
ynh_script_progression --message="Installing nodejs"
ynh_install_nodejs 12
#=================================================
# Install weboob with pip
#=================================================
ynh_script_progression --message="Installing weboob"
ynh_secure_remove --file="${final_path}/venv"
virtualenv --python=python3 --system-site-packages "${final_path}/venv"
(
@ -141,6 +146,7 @@ virtualenv --python=python3 --system-site-packages "${final_path}/venv"
# Install Kresus with npm
#=================================================
ynh_script_progression --message="Installing app"
ynh_use_nodejs
(
cd "$final_path"
@ -183,6 +189,7 @@ ynh_replace_string "__ENV_PATH__" "$PATH" ../conf/systemd.se
ynh_replace_string "__NODEPATH__" "$(dirname "$nodejs_path")" ../conf/systemd.service
# Create a dedicated systemd config
ynh_script_progression --message="Creating systemd configuration"
ynh_add_systemd_config
#=================================================
@ -211,6 +218,7 @@ fi
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx"
service "$app" restart
systemctl reload nginx
@ -232,3 +240,5 @@ Are you facing an issue, want to improve this app or say thank you?
Please open a new issue in this project: https://github.com/YunoHost-Apps/kresus_ynh
"
ynh_send_readme_to_admin "$message"
ynh_script_progression --message="Upgrade of $app completed" --last