2018-02-24 21:03:40 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
2019-01-18 23:41:40 +01:00
|
|
|
# Load common variables for all scripts.
|
|
|
|
source _variables
|
2018-02-24 21:03:40 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2018-02-25 15:14:30 +01:00
|
|
|
unattended_verbosity=$(ynh_app_setting_get $app unattended_verbosity)
|
2018-09-30 12:02:50 +02:00
|
|
|
overwrite_periodic=$(ynh_app_setting_get $app overwrite_periodic)
|
2018-02-25 15:14:30 +01:00
|
|
|
|
2018-02-24 21:03:40 +01:00
|
|
|
#=================================================
|
|
|
|
# CHECK VERSION
|
|
|
|
#=================================================
|
|
|
|
|
2018-07-13 17:38:14 +02:00
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
2018-02-24 21:03:40 +01:00
|
|
|
|
2018-09-30 12:02:50 +02:00
|
|
|
#=================================================
|
|
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# If overwrite_periodic doesn't exist, create it
|
|
|
|
if [ -z "$overwrite_periodic" ]; then
|
|
|
|
overwrite_periodic=1
|
|
|
|
ynh_app_setting_set $app overwrite_periodic $overwrite_periodic
|
|
|
|
fi
|
|
|
|
|
2018-02-24 21:03:40 +01:00
|
|
|
#=================================================
|
|
|
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
|
|
#=================================================
|
|
|
|
|
2018-02-25 15:14:30 +01:00
|
|
|
# It's impossible to make a backup here, because the backup name is going to have 32 characters. Which is not allowed...
|
|
|
|
|
2018-02-24 21:03:40 +01:00
|
|
|
# Backup the current version of the app
|
2018-07-13 17:38:14 +02:00
|
|
|
ynh_backup_before_upgrade
|
|
|
|
ynh_clean_setup () {
|
|
|
|
# restore it if the upgrade fails
|
|
|
|
ynh_restore_upgradebackup
|
|
|
|
}
|
2018-02-24 21:03:40 +01:00
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD UPGRADE STEPS
|
|
|
|
#=================================================
|
2018-02-25 14:46:16 +01:00
|
|
|
# INSTALL DEPENDENCIES
|
2018-02-24 21:03:40 +01:00
|
|
|
#=================================================
|
|
|
|
|
2019-01-18 23:41:40 +01:00
|
|
|
ynh_install_app_dependencies $app_depencencies
|
2018-02-24 21:03:40 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC UPGRADE
|
|
|
|
#=================================================
|
2018-02-25 14:46:16 +01:00
|
|
|
# UPGRADE APTICRON
|
2018-02-24 21:03:40 +01:00
|
|
|
#=================================================
|
|
|
|
|
2018-02-25 14:46:16 +01:00
|
|
|
# Nothing to do here...
|
2018-02-24 21:03:40 +01:00
|
|
|
|
|
|
|
#=================================================
|
2018-02-25 14:46:16 +01:00
|
|
|
# UPGRADE UNATTENDED-UPGRADES
|
2018-02-24 21:03:40 +01:00
|
|
|
#=================================================
|
|
|
|
|
2018-02-25 14:46:16 +01:00
|
|
|
# Nothing to do here...
|
2018-02-24 21:03:40 +01:00
|
|
|
|
|
|
|
#=================================================
|
2018-02-25 14:46:16 +01:00
|
|
|
# UPGRADE APT PERIODIC FOR UNATTENDED
|
2018-02-24 21:03:40 +01:00
|
|
|
#=================================================
|
|
|
|
|
2018-09-30 12:02:50 +02:00
|
|
|
# Overwrite 02periodic config file only if it's allowed
|
|
|
|
if [ $overwrite_periodic -eq 1 ]
|
|
|
|
then
|
|
|
|
ynh_backup_if_checksum_is_different "/etc/apt/apt.conf.d/02periodic"
|
2018-02-24 21:03:40 +01:00
|
|
|
|
2018-09-30 12:02:50 +02:00
|
|
|
cp "../conf/02periodic" "/etc/apt/apt.conf.d/02periodic"
|
|
|
|
ynh_replace_string "__VERBOSITY__" "$unattended_verbosity" "/etc/apt/apt.conf.d/02periodic"
|
|
|
|
# This config file is used by /etc/cron.daily/apt
|
2018-02-24 21:03:40 +01:00
|
|
|
|
2018-09-30 12:02:50 +02:00
|
|
|
ynh_store_file_checksum "/etc/apt/apt.conf.d/02periodic"
|
|
|
|
fi
|
2018-02-24 21:03:40 +01:00
|
|
|
|
|
|
|
#=================================================
|
2018-02-25 14:46:16 +01:00
|
|
|
# UPGRADE APTICRON CRON FILE
|
2018-02-24 21:03:40 +01:00
|
|
|
#=================================================
|
|
|
|
|
2018-02-25 14:46:16 +01:00
|
|
|
# Nothing to do here...
|