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

Progress bar

This commit is contained in:
Maniack Crudelis 2019-02-04 08:08:42 +01:00
parent a413aa716f
commit 4489e07a05
7 changed files with 196 additions and 1 deletions

View file

@ -319,6 +319,90 @@ ynh_clean_check_starting () {
#=================================================
# Print a message as INFO and show progression during an app script
#
# usage: ynh_script_progression --message=message [--weight=weight] [--time]
# | arg: -m, --message= - The text to print
# | arg: -w, --weight= - The weight for this progression. This value is 1 by default. Use a bigger value for a longer part of the script.
# | arg: -t, --time= - Print the execution time since the last call to this helper. Especially usefull to define weights.
# | arg: -l, --last= - Use for the last call of the helper, to fill te progression bar.
increment_progression=0
previous_weight=0
# Define base_time when the file is sourced
base_time=$(date +%s)
ynh_script_progression () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [m]=message= [w]=weight= [t]=time [l]=last )
local message
local weight
local time
local last
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
weight=${weight:-1}
time=${time:-0}
last=${last:-0}
# Get execution time since the last $base_time
local exec_time=$(( $(date +%s) - $base_time ))
base_time=$(date +%s)
# Get the number of occurrences of 'ynh_script_progression' in the script. Except those are commented.
local helper_calls="$(grep --count "^[^#]*ynh_script_progression" $0)"
# Get the number of call with a weight value
local weight_calls=$(grep --perl-regexp --count "^[^#]*ynh_script_progression.*(--weight|-w )" $0)
# Get the weight of each occurrences of 'ynh_script_progression' in the script using --weight
local weight_valuesA="$(grep --perl-regexp "^[^#]*ynh_script_progression.*--weight" $0 | sed 's/.*--weight[= ]\([[:digit:]].*\)/\1/g')"
# Get the weight of each occurrences of 'ynh_script_progression' in the script using -w
local weight_valuesB="$(grep --perl-regexp "^[^#]*ynh_script_progression.*-w " $0 | sed 's/.*-w[= ]\([[:digit:]].*\)/\1/g')"
# Each value will be on a different line.
# Remove each 'end of line' and replace it by a '+' to sum the values.
local weight_values=$(( $(echo "$weight_valuesA" | tr '\n' '+') + $(echo "$weight_valuesB" | tr '\n' '+') 0 ))
# max_progression is a total number of calls to this helper.
# Less the number of calls with a weight value.
# Plus the total of weight values
local max_progression=$(( $helper_calls - $weight_calls + $weight_values ))
# Increment each execution of ynh_script_progression in this script by the weight of the previous call.
increment_progression=$(( $increment_progression + $previous_weight ))
# Store the weight of the current call in $previous_weight for next call
previous_weight=$weight
# Set the scale of the progression bar
local scale=20
# progress_string(1,2) should have the size of the scale.
local progress_string1="####################"
local progress_string0="...................."
# Reduce $increment_progression to the size of the scale
if [ $last -eq 0 ]
then
local effective_progression=$(( $increment_progression * $scale / $max_progression ))
# If last is specified, fill immediately the progression_bar
else
local effective_progression=$scale
fi
# Build $progression_bar from progress_string(1,2) according to $effective_progression
local progression_bar="${progress_string1:0:$effective_progression}${progress_string0:0:$(( $scale - $effective_progression ))}"
local print_exec_time=""
if [ $time -eq 1 ]
then
print_exec_time=" [$(date +%Hh%Mm,%Ss --date="0 + $exec_time sec")]"
fi
ynh_print_info "[$progression_bar] > ${message}${print_exec_time}"
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# Send an email to inform the administrator
#
# usage: ynh_send_readme_to_admin app_message [recipients]

View file

@ -19,6 +19,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Load settings" --weight=2
app=$YNH_APP_INSTANCE_NAME
@ -31,6 +32,7 @@ db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Backup the app main dir" --weight=2
CHECK_SIZE "$final_path"
ynh_backup "$final_path"
@ -38,12 +40,14 @@ ynh_backup "$final_path"
#=================================================
# BACKUP NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Backup nginx configuration"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Backup the mysql database" --weight=3
ynh_mysql_dump_db "$db_name" > db.sql
CHECK_SIZE "db.sql"
@ -53,18 +57,27 @@ CHECK_SIZE "db.sql"
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_script_progression --message="Backup logrotate configuration"
ynh_backup "/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_script_progression --message="Backup systemd configuration"
ynh_backup "/etc/systemd/system/$app.service"
#=================================================
# BACKUP FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression --message="Backup fail2ban configuration"
ynh_backup "/etc/fail2ban/jail.d/$app.conf"
ynh_backup "/etc/fail2ban/filter.d/$app.conf"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Backup completed" --last

View file

@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
ynh_script_progression --message="Retrieve arguments from the manifest"
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
@ -24,6 +25,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Load settings" --weight=5
final_path=$(ynh_app_setting_get $app final_path)
mypads=$(ynh_app_setting_get $app mypads)
@ -32,6 +34,7 @@ port=$(ynh_app_setting_get $app port)
#=================================================
# CHECK THE SYNTAX OF THE PATHS
#=================================================
ynh_script_progression --message="Check the syntax of the paths"
test -n "$old_path" || old_path="/"
test -n "$new_path" || new_path="/"
@ -41,6 +44,7 @@ old_path=$(ynh_normalize_url_path $old_path)
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Activate maintenance mode" --weight=2
path_url=$old_path
domain=$old_domain
@ -78,6 +82,7 @@ ynh_abort_if_errors
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Modify url in nginx configuration" --weight=3
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -112,12 +117,14 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reload nginx"
ynh_systemd_action --action=reload --service_name=nginx
#=================================================
# CHECK ETHERPAD STARTING
#=================================================
ynh_script_progression --message="Restart Etherpad" --weight=10
# Wait for etherpad to be fully started
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
@ -125,7 +132,14 @@ ynh_systemd_action --action=restart --line_match="You can access your Etherpad i
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Disable maintenance mode" --weight=5
path_url=$old_path
domain=$old_domain
ynh_maintenance_mode_OFF
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of url completed" --last

View file

@ -25,6 +25,7 @@ ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
ynh_script_progression --message="Retrieve arguments from the manifest"
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
@ -41,6 +42,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
#=================================================
ynh_script_progression --message="Check if the app can be installed"
ynh_print_OFF
if [ "${#password}" -lt 8 ] || [ "${#password}" -gt 30 ]
@ -61,6 +63,7 @@ ynh_webpath_register $app $domain $path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Store settings from manifest" --weight=3
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
@ -77,6 +80,7 @@ ynh_app_setting_set $app useldap $useldap
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Find a free port" --weight=2
# Find a free port
port=$(ynh_find_port 9001)
@ -85,6 +89,7 @@ ynh_app_setting_set $app port $port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Install dependencies" --weight=120
if [ "$export" = "abiword" ]; then
ynh_install_app_dependencies $abiword_app_depencencies
@ -95,12 +100,14 @@ fi
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Install NodeJS" --weight=12
ynh_install_nodejs $nodejs_version
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Create a mysql database"
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name
@ -109,6 +116,7 @@ ynh_mysql_setup_db $db_name $db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Download, check and unpack source" --weight=4
ynh_app_setting_set $app final_path $final_path
# Download, check integrity and uncompress the source from app.src
@ -117,6 +125,7 @@ ynh_setup_source "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configure nginx" --weight=2
# Create a dedicated nginx config
ynh_add_nginx_config
@ -124,6 +133,7 @@ ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Create a dedicated user" --weight=3
# Create a dedicated system user
ynh_system_user_create $app $final_path
@ -133,6 +143,7 @@ ynh_system_user_create $app $final_path
#=================================================
# HANDLE LOG FILES AND LOGROTATE
#=================================================
ynh_script_progression --message="Configure logrotate"
# Create log directory
mkdir -p /var/log/$app
@ -147,6 +158,7 @@ ynh_use_logrotate
#=================================================
# INSTALL ETHERPAD
#=================================================
ynh_script_progression --message="Install Etherpad" --weight=90
# Install dependencies and proceed to the installation
ynh_use_nodejs
@ -156,6 +168,7 @@ npm install forever -g >> $install_log 2>&1
#=================================================
# CONFIGURE ETHERPAD
#=================================================
ynh_script_progression --message="Configure Etherpad" --weight=6
cp ../conf/settings.json "$final_path/settings.json"
cp ../conf/credentials.json "$final_path/credentials.json"
@ -202,6 +215,7 @@ chmod 600 $final_path/credentials.json
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configure systemd" --weight=4
ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service"
# Create a dedicated systemd config
@ -216,6 +230,7 @@ yunohost service add $app --log "/var/log/$app/etherpad.log"
#=================================================
# INSTALL FRAMAPAD'S PLUGINS
#=================================================
ynh_script_progression --message="Install Etherpad plugins" --weight=90
pushd "$final_path"
# Add Left/Center/Right/Justify to lines of text in a pad
@ -275,6 +290,7 @@ fi
#=================================================
# SETUP FAIL2BAN
#=================================================
ynh_script_progression --message="Configure fail2ban" --weight=13
# Create a dedicated fail2ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
@ -282,6 +298,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failrege
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Setup SSOwat"
if [ $is_public -eq 1 ]; then
ynh_app_setting_set $app skipped_uris "/"
@ -293,12 +310,14 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reload nginx"
ynh_systemd_action --action=reload --service_name=nginx
#=================================================
# CHECK ETHERPAD STARTING
#=================================================
ynh_script_progression --message="Restart Etherpad" --weight=20
# Wait for etherpad to be fully started
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
@ -335,3 +354,9 @@ If you are facing an issue or want to improve this app, please open a new issue
ynh_send_readme_to_admin "$message" "$admin"
ynh_print_ON
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation completed" --last

View file

@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Load settings" --weight=3
app=$YNH_APP_INSTANCE_NAME
@ -25,6 +26,7 @@ export=$(ynh_app_setting_get $app export)
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stop and remove the service" --weight=2
# Remove the dedicated systemd config
ynh_remove_systemd_config
@ -36,7 +38,7 @@ ynh_remove_systemd_config
# Check if the service is declared in YunoHost
if yunohost service status | grep -q $app
then
ynh_print_info "Remove $app service" >&2
ynh_print_info "Remove $app service"
yunohost service remove $app
fi
@ -46,6 +48,7 @@ fi
if [ "$export" != "none" ]
then
ynh_script_progression --message="Remove dependencies" --weight=60
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
fi
@ -53,12 +56,14 @@ fi
#=================================================
# REMOVE NODEJS
#=================================================
ynh_script_progression --message="Remove NodeJS version for Etherpad" --weight=3
ynh_remove_nodejs
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Remove the mysql database" --weight=2
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_name $db_name
@ -66,6 +71,7 @@ ynh_mysql_remove_db $db_name $db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Remove app main directory"
# Remove the app directory securely
ynh_secure_remove "/var/www/$app"
@ -73,6 +79,7 @@ ynh_secure_remove "/var/www/$app"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Remove nginx configuration" --weight=2
# Remove the dedicated nginx config
ynh_remove_nginx_config
@ -80,6 +87,7 @@ ynh_remove_nginx_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Remove logrotate configuration"
# Remove the app-specific logrotate config
ynh_remove_logrotate
@ -87,6 +95,7 @@ ynh_remove_logrotate
#=================================================
# REMOVE FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression --message="Remove fail2ban configuration" --weight=7
# Remove the dedicated fail2ban config
ynh_remove_fail2ban_config
@ -96,6 +105,13 @@ ynh_remove_fail2ban_config
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Remove the dedicated user" --weight=2
# Delete dedicated system user
ynh_system_user_delete $app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Deletion completed" --last

View file

@ -25,6 +25,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Load settings" --weight=4
app=$YNH_APP_INSTANCE_NAME
@ -49,6 +50,7 @@ test ! -d $final_path \
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Activate maintenance mode" --weight=2
ynh_maintenance_mode_ON
@ -63,12 +65,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restore the app main directory"
ynh_restore_file "$final_path"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restore the mysql database"
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
ynh_mysql_setup_db $db_name $db_name $db_pwd
@ -77,6 +81,7 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreate the dedicated user" --weight=2
# Create the dedicated user (if not existing)
ynh_system_user_create $app $final_path
@ -100,6 +105,7 @@ ynh_restore_file "/etc/logrotate.d/$app"
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstall dependencies" --weight=60
if [ "$export" = "abiword" ]; then
ynh_install_app_dependencies $abiword_app_depencencies
@ -110,12 +116,14 @@ fi
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Reinstall NodeJS" --weight=7
ynh_install_nodejs $nodejs_version
#=================================================
# INSTALL ETHERPAD DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstall Etherpad node dependencies" --weight=17
ynh_use_nodejs
npm cache clean
@ -137,6 +145,7 @@ yunohost service add $app --log "/var/log/$app/etherpad.log"
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restore the systemd configuration"
ynh_restore_file "/etc/systemd/system/$app.service"
systemctl enable $app.service
@ -144,6 +153,7 @@ systemctl enable $app.service
#=================================================
# RESTORE FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression --message="Restore the fail2ban configuration" --weight=6
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
@ -152,12 +162,14 @@ ynh_systemd_action --action=restart --service_name=fail2ban
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reload nginx"
ynh_systemd_action --action=reload --service_name=nginx
#=================================================
# CHECK ETHERPAD STARTING
#=================================================
ynh_script_progression --message="Restart Etherpad" --weight=8
# Wait for etherpad to be fully started
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
@ -165,6 +177,7 @@ ynh_systemd_action --action=restart --line_match="You can access your Etherpad i
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Disable maintenance mode" --weight=7
ynh_maintenance_mode_OFF
@ -191,3 +204,9 @@ If you are facing an issue or want to improve this app, please open a new issue
ynh_send_readme_to_admin "$message" "$admin"
ynh_print_ON
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed" --last

View file

@ -14,6 +14,7 @@ source _variables
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Load settings" --weight=20
app=$YNH_APP_INSTANCE_NAME
@ -41,6 +42,7 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensure downward compatibility" --weight=2
# Convert is_public as a boolean
if [ "$is_public" = "Yes" ]; then
@ -99,6 +101,7 @@ fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backup the app before upgrading" --weight=35
# Backup the current version of the app
ynh_backup_before_upgrade
@ -115,12 +118,14 @@ ynh_abort_if_errors
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Activate maintenance mode" --weight=2
ynh_maintenance_mode_ON
#=================================================
# STOP ETHERPAD
#=================================================
ynh_script_progression --message="Stop Etherpad service" --weight=3
ynh_systemd_action --action=stop
@ -139,6 +144,7 @@ fi
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Download, check and unpack source" --weight=5
if [ "$export" = "abiword" ]; then
ynh_install_app_dependencies $abiword_app_depencencies
@ -149,6 +155,7 @@ fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Reconfigure nginx"
# Create a dedicated nginx config
ynh_add_nginx_config
@ -156,6 +163,7 @@ ynh_add_nginx_config
#=================================================
# UPGRADE NODEJS
#=================================================
ynh_script_progression --message="Upgrade NodeJS" --weight=4
# Remove the old nvm helper.
if [ -d /opt/nvm ]
@ -169,6 +177,7 @@ ynh_install_nodejs $nodejs_version
#=================================================
# UPGRADE NPM MODULES
#=================================================
ynh_script_progression --message="Upgrade Etherpad npm modules" --weight=60
# Update the main modules of etherpad
(cd "$final_path/src"
@ -192,6 +201,7 @@ done <<< "$(ls -1 "$final_path/node_modules" | grep "^ep_")")
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Reconfigure Etherpad" --weight=3
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
ynh_backup_if_checksum_is_different "$final_path/settings.json"
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
@ -240,6 +250,7 @@ fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Create a dedicated user"
# Create a dedicated user (if not existing)
ynh_system_user_create $app $final_path
@ -257,6 +268,7 @@ chown $app -R /var/log/$app/etherpad.log
#=================================================
# UPGRADE FAIL2BAN
#=================================================
ynh_script_progression --message="Reconfigure fail2ban" --weight=8
# Create a dedicated fail2ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
@ -264,6 +276,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failrege
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Reconfigure logrotate"
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
@ -271,6 +284,7 @@ ynh_use_logrotate --non-append
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Reconfigure systemd" --weight=2
ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service"
# Create a dedicated systemd config
@ -291,6 +305,7 @@ fi
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Reconfigure SSOwat"
# Make app public if necessary
if [ $is_public -eq 1 ]; then
@ -303,12 +318,14 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reload nginx"
ynh_systemd_action --action=reload --service_name=nginx
#=================================================
# CHECK ETHERPAD STARTING
#=================================================
ynh_script_progression --message="Restart Etherpad" --weight=9
# Wait for etherpad to be fully started
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
@ -316,5 +333,12 @@ ynh_systemd_action --action=restart --line_match="You can access your Etherpad i
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Disable maintenance mode" --weight=5
ynh_maintenance_mode_OFF
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade completed" --last