| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #!/bin/bash
- #=================================================
- # IMPORT GENERIC HELPERS
- #=================================================
- source _common.sh
- source /usr/share/yunohost/helpers
- #=================================================
- # ENSURE DOWNWARD COMPATIBILITY
- #=================================================
- ynh_script_progression "Ensuring downward compatibility..."
- _fix_frequencies
- _set_frequencies
- # If encrypt doesn't exist, create it
- 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 --key="encrypt" --value="$encrypt"
- fi
- # If core_backup doesn't exist, create it
- ynh_app_setting_set_default --key=core_backup --value="$(grep "^ynh_core_backup=" "$install_dir/Backup_list.conf" | cut -d= -f2)"
- # If apps_backup doesn't exist, create it
- ynh_app_setting_set_default --key=apps_backup --value="$(grep --count --max-count=1 "^ynh_app_backup=" "$install_dir/Backup_list.conf")"
- # If overwrite_cron doesn't exist, create it
- ynh_app_setting_set_default --key=overwrite_cron --value=1
- # If admin_mail_html doesn't exist, create it
- ynh_app_setting_set_default --key=admin_mail_html --value=1
- #=================================================
- # DOWNLOAD, CHECK AND UNPACK SOURCE
- #=================================================
- ynh_script_progression "Upgrading source files..."
- # Download, check integrity, uncompress and patch the source from app.src
- ynh_setup_source --dest_dir="$install_dir" --full_replace --keep="passkey Backup_list.conf"
- chown -R "root:root" "$install_dir"
- #=================================================
- # UPDATE A CONFIG FILE
- #=================================================
- ynh_script_progression "Updating $app's configuration files..."
- #=================================================
- # REAPPLY SYSTEM CONFIGURATIONS
- #=================================================
- ynh_script_progression "Upgrading system configurations related to $app..."
- # Use logrotate to manage app-specific logfile(s)
- ynh_config_add_logrotate
- if (( overwrite_cron == 1 )); then
- # Add Cron configuration file
- ynh_config_add --template="archivist.cron" --destination="/etc/cron.d/$app"
- fi
- #=================================================
- # END OF SCRIPT
- #=================================================
- ynh_script_progression "Upgrade of $app completed"
|