2017-11-01 20:57:58 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2020-04-08 19:59:52 +02:00
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2018-09-30 20:01:19 +02:00
|
|
|
#=================================================
|
|
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
|
|
#=================================================
|
2019-05-26 17:00:09 +02:00
|
|
|
ynh_script_progression --message="Ensuring downward compatibility..."
|
2018-09-30 20:01:19 +02:00
|
|
|
|
2024-03-29 13:36:54 +01:00
|
|
|
_fix_frequencies
|
2024-03-29 12:47:49 +01:00
|
|
|
_set_frequencies
|
|
|
|
|
2018-09-30 20:01:19 +02:00
|
|
|
# If encrypt doesn't exist, create it
|
2024-03-29 12:47:49 +01:00
|
|
|
if [ -z "${encrypt:-}" ]; then
|
|
|
|
encrypt="$(grep "^encrypt=" "$install_dir/Backup_list.conf" | cut -d= -f2)"
|
|
|
|
if [ "$encrypt" = true ]; then
|
|
|
|
encrypt=1
|
|
|
|
else
|
|
|
|
encrypt=0
|
|
|
|
fi
|
|
|
|
ynh_app_setting_set --app="$app" --key="encrypt" --value="$encrypt"
|
2018-09-30 20:01:19 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# If core_backup doesn't exist, create it
|
2024-03-29 12:47:49 +01:00
|
|
|
if [ -z "${core_backup:-}" ]; then
|
|
|
|
core_backup="$(grep "^ynh_core_backup=" "$install_dir/Backup_list.conf" | cut -d= -f2)"
|
|
|
|
ynh_app_setting_set --app="$app" --key="core_backup" --value="$core_backup"
|
2018-09-30 20:01:19 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# If apps_backup doesn't exist, create it
|
2024-03-29 12:47:49 +01:00
|
|
|
if [ -z "${apps_backup:-}" ]; then
|
|
|
|
apps_backup="$(grep --count --max-count=1 "^ynh_app_backup=" "$install_dir/Backup_list.conf")"
|
|
|
|
ynh_app_setting_set --app="$app" --key="apps_backup" --value="$apps_backup"
|
2018-09-30 20:01:19 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# If overwrite_cron doesn't exist, create it
|
2024-03-29 12:47:49 +01:00
|
|
|
if [ -z "${overwrite_cron:-}" ]; then
|
|
|
|
overwrite_cron=1
|
|
|
|
ynh_app_setting_set --app="$app" --key="overwrite_cron" --value="$overwrite_cron"
|
2018-09-30 20:01:19 +02:00
|
|
|
fi
|
|
|
|
|
2019-01-30 19:21:03 +01:00
|
|
|
# If admin_mail_html doesn't exist, create it
|
2024-03-29 12:47:49 +01:00
|
|
|
if [ -z "${admin_mail_html:-}" ]; then
|
|
|
|
admin_mail_html=1
|
|
|
|
ynh_app_setting_set --app="$app" --key="admin_mail_html" --value="$admin_mail_html"
|
2019-01-30 19:21:03 +01:00
|
|
|
fi
|
|
|
|
|
2017-11-01 20:57:58 +01:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2024-03-29 12:47:49 +01:00
|
|
|
ynh_script_progression --message="Upgrading source files..." --weight=2
|
2017-11-01 20:57:58 +01:00
|
|
|
|
2024-03-29 12:47:49 +01:00
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2024-03-29 12:50:20 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="passkey Backup_list.conf"
|
2022-07-16 19:44:33 +02:00
|
|
|
|
2024-03-29 12:47:49 +01:00
|
|
|
chown -R "root:root" "$install_dir"
|
2017-11-01 20:57:58 +01:00
|
|
|
|
2019-01-13 17:19:46 +01:00
|
|
|
#=================================================
|
2024-03-29 12:47:49 +01:00
|
|
|
# UPDATE A CONFIG FILE
|
2019-01-13 17:19:46 +01:00
|
|
|
#=================================================
|
2024-03-29 12:47:49 +01:00
|
|
|
ynh_script_progression --message="Updating $app's configuration files..." --weight=1
|
2019-01-13 17:19:46 +01:00
|
|
|
|
2017-11-01 20:57:58 +01:00
|
|
|
#=================================================
|
2024-03-29 12:47:49 +01:00
|
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
2017-11-01 20:57:58 +01:00
|
|
|
#=================================================
|
2024-03-29 12:47:49 +01:00
|
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
2017-11-01 20:57:58 +01:00
|
|
|
|
2022-07-16 19:44:33 +02:00
|
|
|
# Use logrotate to manage app-specific logfile(s)
|
|
|
|
ynh_use_logrotate --non-append
|
2019-01-19 18:55:14 +01:00
|
|
|
|
2024-03-29 12:47:49 +01:00
|
|
|
if (( overwrite_cron == 1 )); then
|
|
|
|
# Add Cron configuration file
|
|
|
|
ynh_add_config --template="archivist.cron" --destination="/etc/cron.d/$app"
|
|
|
|
fi
|
2019-01-19 18:55:14 +01:00
|
|
|
|
2019-01-30 16:07:38 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2019-05-26 17:00:09 +02:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|