mirror of
https://github.com/YunoHost-Apps/radicale_ynh.git
synced 2024-09-03 20:16:14 +02:00
Add progression bar
This commit is contained in:
parent
f08c202b9d
commit
09d4d9f17b
9 changed files with 193 additions and 2 deletions
|
@ -629,6 +629,84 @@ 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}"
|
||||
}
|
||||
|
||||
# Send an email to inform the administrator
|
||||
#
|
||||
# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
|
||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Retrieve arguments from the manifest"
|
||||
|
||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||
infcloud=$(ynh_app_setting_get $app infcloud)
|
||||
|
@ -23,10 +24,10 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
ynh_print_info "InfCloud will be removed." >&2
|
||||
action_print="Remove"
|
||||
infcloud=0
|
||||
else
|
||||
ynh_print_info "InfCloud will be installed." >&2
|
||||
action_print="Install"
|
||||
infcloud=1
|
||||
fi
|
||||
|
||||
|
@ -35,6 +36,7 @@ fi
|
|||
#=================================================
|
||||
# INSTALL OR REMOVE INFCLOUD
|
||||
#=================================================
|
||||
ynh_script_progression --message="$action_print InfCloud." --weight=9
|
||||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
|
@ -164,8 +166,15 @@ else
|
|||
ynh_app_setting_set $app unprotected_uris "/"
|
||||
fi
|
||||
|
||||
ynh_script_progression --message="Reconfigure SSOwat"
|
||||
# Regen ssowat configuration
|
||||
yunohost app ssowatconf
|
||||
|
||||
# Update the config of the app
|
||||
ynh_app_setting_set $app infcloud $infcloud
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Execution completed" --last
|
||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Retrieve arguments from the manifest" --weight=3
|
||||
|
||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
|
@ -49,6 +50,7 @@ fi
|
|||
#=================================================
|
||||
# RESET THE CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reset the config file $config_file" --weight=9
|
||||
|
||||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different "$config_file"
|
||||
|
@ -144,5 +146,13 @@ fi
|
|||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$config_file"
|
||||
|
||||
ynh_script_progression --message="Restart Radicale" --weight=2
|
||||
|
||||
# Restart uwsgi to restart radicale
|
||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Execution completed" --last
|
||||
|
|
|
@ -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 @@ infcloud=$(ynh_app_setting_get $app infcloud)
|
|||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backup the app main dir" --weight=2
|
||||
|
||||
CHECK_SIZE "$final_path"
|
||||
ynh_backup "$final_path"
|
||||
|
@ -40,12 +42,14 @@ ynh_backup "/opt/yunohost/$app"
|
|||
#=================================================
|
||||
# BACKUP NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backup nginx configuration"
|
||||
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backup php-fpm configuration"
|
||||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
|
@ -57,12 +61,14 @@ fi
|
|||
#=================================================
|
||||
# BACKUP UWSGI CONFIG
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backup uWSGI configuration"
|
||||
|
||||
ynh_backup "/etc/uwsgi/apps-available/radicale.ini"
|
||||
|
||||
#=================================================
|
||||
# BACKUP RADICALE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backup Radicale configuration"
|
||||
|
||||
CHECK_SIZE "/etc/$app"
|
||||
ynh_backup "/etc/$app"
|
||||
|
@ -70,5 +76,12 @@ ynh_backup "/etc/$app"
|
|||
#=================================================
|
||||
# BACKUP LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backup logrotate configuration"
|
||||
|
||||
ynh_backup "/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Backup completed" --last
|
||||
|
|
|
@ -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=2
|
||||
|
||||
infcloud=$(ynh_app_setting_get $app infcloud)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
|
@ -31,6 +33,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
#=================================================
|
||||
# CHECK THE SYNTAX OF THE PATHS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Check the syntax of the paths"
|
||||
|
||||
# Remove /infcloud in $old_path
|
||||
if [ $infcloud -eq 1 ]
|
||||
|
@ -46,6 +49,7 @@ old_path=$(ynh_normalize_url_path $old_path)
|
|||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Activate maintenance mode"
|
||||
|
||||
path_url=$old_path
|
||||
domain=$old_domain
|
||||
|
@ -79,6 +83,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Modify url in nginx configuration" --weight=2
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
|
@ -128,6 +133,7 @@ fi
|
|||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Reconfigure SSOwat"
|
||||
# Add /infcloud to the path of radicale to access it from the portal
|
||||
echo "sudo yunohost --verbose app setting $app path -v \"${new_path%/}/infcloud\"; sudo yunohost app ssowatconf" | at now + 1 min >&2
|
||||
domain_regex=$(echo "$new_domain" | sed 's@-@.@g')
|
||||
|
@ -138,6 +144,7 @@ fi
|
|||
#=================================================
|
||||
# RESTART UWSGI
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restart Radicale" --weight=2
|
||||
|
||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||
|
||||
|
@ -146,13 +153,21 @@ ynh_systemd_action --action=restart --service_name=uwsgi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reload nginx"
|
||||
|
||||
ynh_systemd_action --action=reload --service_name=nginx
|
||||
|
||||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Disable maintenance mode" --weight=4
|
||||
|
||||
path_url=$old_path
|
||||
domain=$old_domain
|
||||
ynh_maintenance_mode_OFF
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of url completed" --last
|
||||
|
|
|
@ -21,6 +21,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
|
||||
|
@ -36,6 +37,7 @@ version=$(ynh_app_upstream_version)
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Check if the app can be installed"
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
@ -49,6 +51,7 @@ ynh_webpath_register $app $domain $path_url
|
|||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Store settings from manifest" --weight=4
|
||||
|
||||
ynh_app_setting_set $app domain $domain
|
||||
ynh_app_setting_set $app path $path_url
|
||||
|
@ -66,12 +69,14 @@ ynh_app_setting_set $app overwrite_phpfpm "1"
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Install dependencies" --weight=25
|
||||
|
||||
ynh_install_app_dependencies $app_depencencies
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configure nginx" --weight=2
|
||||
|
||||
ynh_add_nginx_config
|
||||
if [ $infcloud -eq 1 ]
|
||||
|
@ -84,6 +89,7 @@ ynh_store_file_checksum "$finalnginxconf"
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Create a dedicated user" --weight=2
|
||||
|
||||
# Create a dedicated system user
|
||||
ynh_system_user_create $app
|
||||
|
@ -93,6 +99,7 @@ ynh_system_user_create $app
|
|||
#=================================================
|
||||
# INSTALL RADICALE IN A VIRTUALENV
|
||||
#=================================================
|
||||
ynh_script_progression --message="Install radicale in a virtualenv" --weight=15
|
||||
|
||||
# Init virtualenv
|
||||
virtualenv /opt/yunohost/$app
|
||||
|
@ -102,6 +109,7 @@ version=$(ynh_app_setting_get $app version $version)
|
|||
#=================================================
|
||||
# COPY FILES INTO $FINAL_PATH
|
||||
#=================================================
|
||||
ynh_script_progression --message="Download, check and unpack source" --weight=2
|
||||
|
||||
# Create the directory and set the path in the config
|
||||
mkdir "$final_path"
|
||||
|
@ -130,6 +138,7 @@ fi
|
|||
#=================================================
|
||||
# CONFIGURE RADICALE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configure Radicale" --weight=5
|
||||
|
||||
mkdir -p /etc/$app
|
||||
cp ../conf/config /etc/$app/
|
||||
|
@ -219,6 +228,7 @@ ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
|
|||
#=================================================
|
||||
# GENERATE CALENDARS AND ADDRESS BOOKS FOR ALL USERS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Generate calendars and address books for all users" --weight=3
|
||||
|
||||
# Create default calendars and address books for each users
|
||||
while read user
|
||||
|
@ -231,6 +241,7 @@ done <<< "$(yunohost user list | grep username | cut -d ":" -f 2 | cut -c 2-)"
|
|||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restart Radicale" --weight=2
|
||||
|
||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||
yunohost service add uwsgi --log "/var/log/uwsgi/app/radicale.log"
|
||||
|
@ -248,6 +259,7 @@ ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_delete
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setup SSOwat" --weight=3
|
||||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
|
@ -268,6 +280,7 @@ fi
|
|||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configure logrotate" --weight=2
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
@ -278,6 +291,7 @@ ynh_use_logrotate
|
|||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Configure php-fpm" --weight=4
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config
|
||||
fi
|
||||
|
@ -285,6 +299,7 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reload nginx" --weight=4
|
||||
|
||||
ynh_systemd_action --action=reload --service_name=nginx
|
||||
|
||||
|
@ -312,5 +327,9 @@ You can configure this app easily by using the experimental config-panel feature
|
|||
You can also find some specific actions for this app by using the experimental action feature: $admin_panel/actions.
|
||||
|
||||
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/radicale_ynh"
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_send_readme_to_admin --app_message="$message" --recipients="$admin" --type="install"
|
||||
ynh_script_progression --message="Installation completed" --last
|
||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Load settings"
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -22,6 +23,7 @@ domain=$(ynh_app_setting_get $app domain)
|
|||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stop and remove the service" --weight=3
|
||||
|
||||
# Delete uwsgi configuration
|
||||
ynh_systemd_action --action=stop --service_name=uwsgi
|
||||
|
@ -34,6 +36,7 @@ ynh_secure_remove "/etc/uwsgi/apps-available/radicale.ini"
|
|||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Remove dependencies" --weight=10
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
@ -41,6 +44,7 @@ ynh_remove_app_dependencies
|
|||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Remove app main directory"
|
||||
|
||||
ynh_secure_remove "/var/www/$app"
|
||||
ynh_secure_remove "/opt/yunohost/$app"
|
||||
|
@ -48,6 +52,7 @@ ynh_secure_remove "/opt/yunohost/$app"
|
|||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Remove nginx configuration"
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
@ -55,6 +60,7 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Remove php-fpm configuration" --weight=3
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
ynh_remove_fpm_config
|
||||
|
@ -62,6 +68,7 @@ ynh_remove_fpm_config
|
|||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIG
|
||||
#=================================================
|
||||
ynh_script_progression --message="Remove logrotate configuration" --weight=3
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
@ -96,5 +103,12 @@ fi
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Remove the dedicated user"
|
||||
|
||||
ynh_system_user_delete $app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Deletion completed" --last
|
||||
|
|
|
@ -21,6 +21,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Load settings" --weight=2
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -44,6 +45,7 @@ test ! -d "/opt/yunohost/$app" \
|
|||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Activate maintenance mode" --weight=2
|
||||
|
||||
ynh_maintenance_mode_ON
|
||||
|
||||
|
@ -58,12 +60,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstall dependencies" --weight=25
|
||||
|
||||
ynh_install_app_dependencies $app_depencencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restore the app main directory"
|
||||
|
||||
ynh_restore_file "$final_path"
|
||||
mkdir -p /opt/yunohost
|
||||
|
@ -72,6 +76,7 @@ ynh_restore_file "/opt/yunohost/$app"
|
|||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreate the dedicated user" --weight=3
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
@ -82,6 +87,7 @@ ynh_system_user_create $app
|
|||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Reload php-fpm" --weight=2
|
||||
ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
|
||||
ynh_systemd_action --action=reload --service_name=php5-fpm
|
||||
fi
|
||||
|
@ -126,6 +132,7 @@ ynh_restore_file "/etc/logrotate.d/$app"
|
|||
#=================================================
|
||||
# RELOAD NGINX AND UWSGI
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reload nginx and restart Radicale"
|
||||
|
||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||
ynh_systemd_action --action=reload --service_name=nginx
|
||||
|
@ -133,6 +140,7 @@ ynh_systemd_action --action=reload --service_name=nginx
|
|||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Disable maintenance mode" --weight=4
|
||||
|
||||
ynh_maintenance_mode_OFF
|
||||
|
||||
|
@ -162,3 +170,9 @@ You can also find some specific actions for this app by using the experimental a
|
|||
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/radicale_ynh"
|
||||
|
||||
ynh_send_readme_to_admin --app_message="$message" --recipients="$admin" --type="restore"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed" --last
|
||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Load settings" --weight=6
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -45,6 +46,7 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensure downward compatibility"
|
||||
|
||||
ynh_app_setting_delete $app unprotected_regex
|
||||
|
||||
|
@ -103,6 +105,7 @@ fi
|
|||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backup the app before upgrading" --weight=9
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
@ -127,6 +130,7 @@ path_url=$(ynh_normalize_url_path $path_url)
|
|||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Activate maintenance mode"
|
||||
|
||||
ynh_maintenance_mode_ON
|
||||
|
||||
|
@ -139,6 +143,7 @@ ynh_maintenance_mode_ON
|
|||
# Overwrite the nginx configuration only if it's allowed
|
||||
if [ $overwrite_nginx -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Reconfigure nginx" --weight=2
|
||||
ynh_add_nginx_config
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
|
@ -151,6 +156,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
|
||||
|
@ -164,6 +170,7 @@ then
|
|||
# Overwrite the php-fpm configuration only if it's allowed
|
||||
if [ $overwrite_phpfpm -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Reconfigure php-fpm" --weight=2
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config
|
||||
fi
|
||||
|
@ -177,6 +184,7 @@ fi
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrade Radicale in its virtualenv" --weight=6
|
||||
# Upgrade pip packages
|
||||
ynh_secure_remove /opt/yunohost/$app
|
||||
virtualenv /opt/yunohost/$app
|
||||
|
@ -187,6 +195,7 @@ fi
|
|||
#=================================================
|
||||
# COPY FILES INTO $FINAL_PATH
|
||||
#=================================================
|
||||
ynh_script_progression --message="Download, check and unpack source"
|
||||
|
||||
# Copy files to the right place
|
||||
mkdir -p $final_path/collections
|
||||
|
@ -221,6 +230,7 @@ fi
|
|||
#=================================================
|
||||
# CONFIGURE RADICALE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfigure Radicale" --weight=5
|
||||
|
||||
# Overwrite the logging config file only if it's allowed
|
||||
if [ $overwrite_logging -eq 1 ]
|
||||
|
@ -345,6 +355,7 @@ cp ../conf/radicale.ini /etc/uwsgi/apps-available/
|
|||
#=================================================
|
||||
# RESTART UWSGI
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restart Radicale" --weight=3
|
||||
|
||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||
|
||||
|
@ -359,6 +370,7 @@ ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_delete
|
|||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfigure logrotate" --weight=3
|
||||
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
|
@ -367,6 +379,7 @@ ynh_use_logrotate --non-append
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfigure SSOwat" --weight=2
|
||||
|
||||
if [ $infcloud -eq 1 ]
|
||||
then
|
||||
|
@ -387,12 +400,14 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reload nginx"
|
||||
|
||||
ynh_systemd_action --action=reload --service_name=nginx
|
||||
|
||||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Disable maintenance mode" --weight=5
|
||||
|
||||
ynh_maintenance_mode_OFF
|
||||
|
||||
|
@ -420,5 +435,9 @@ You can configure this app easily by using the experimental config-panel feature
|
|||
You can also find some specific actions for this app by using the experimental action feature: $admin_panel/actions.
|
||||
|
||||
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/radicale_ynh"
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_send_readme_to_admin --app_message="$message" --recipients="$admin" --type="upgrade"
|
||||
ynh_script_progression --message="Upgrade completed" --last
|
||||
|
|
Loading…
Add table
Reference in a new issue