unattended_upgrades_ynh/scripts/restore

91 lines
3.5 KiB
Text
Raw Normal View History

2018-02-24 21:03:40 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2018-07-13 17:38:14 +02:00
source ../settings/scripts/_common.sh
2018-02-24 21:03:40 +01:00
source /usr/share/yunohost/helpers
2019-01-18 23:41:40 +01:00
# Load common variables for all scripts.
source ../settings/scripts/_variables
2018-02-24 21:03:40 +01:00
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
2019-01-30 19:18:18 +01:00
ynh_script_progression --message="Load settings"
2018-02-24 21:03:40 +01:00
app=$YNH_APP_INSTANCE_NAME
#=================================================
# SPECIFIC RESTORE
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
2019-01-30 19:18:18 +01:00
ynh_script_progression --message="Reinstall dependencies" --weight=10
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
#=================================================
2018-02-25 14:46:16 +01:00
# RESTORE UNATTENDED-UPGRADES CONFIG
2018-02-24 21:03:40 +01:00
#=================================================
2018-02-25 14:46:16 +01:00
ynh_restore_file "/etc/apt/apt.conf.d/50unattended-upgrades"
# Restore also the backup config file
ynh_restore_file "/etc/apt/50unattended-upgrades.backup"
2018-02-24 21:03:40 +01:00
#=================================================
2018-02-25 14:46:16 +01:00
# RESTORE APT PERIODIC
2018-02-24 21:03:40 +01:00
#=================================================
2018-02-25 14:46:16 +01:00
ynh_restore_file "/etc/apt/apt.conf.d/02periodic"
2018-02-24 21:03:40 +01:00
#=================================================
2018-02-25 14:46:16 +01:00
# RESTORE APTICRON CONFIG
2018-02-24 21:03:40 +01:00
#=================================================
2018-02-25 14:46:16 +01:00
ynh_restore_file "/etc/apticron/apticron.conf"
2018-02-24 21:03:40 +01:00
#=================================================
2019-01-18 23:55:22 +01:00
# RESTORE CRON FILE
2018-02-24 21:03:40 +01:00
#=================================================
2018-02-25 14:46:16 +01:00
ynh_restore_file "/etc/cron.d/apticron"
2018-02-24 21:03:40 +01:00
#=================================================
# GENERIC FINALISATION
#=================================================
2018-02-25 14:46:16 +01:00
# SEND A README FOR THE ADMIN
2018-02-24 21:03:40 +01:00
#=================================================
2019-01-21 13:24:26 +01:00
# Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
2019-01-30 19:36:12 +01:00
echo "To modify any option of unattended-upgrades, please have a look to /etc/apt/apt.conf.d/50unattended-upgrades and
2018-02-25 14:46:16 +01:00
/etc/apt/apt.conf.d/02periodic
Unattended-upgrades will be executed every day at midnight.
2018-02-24 21:03:40 +01:00
2018-02-25 15:14:30 +01:00
To modify the configuration of apticron, please have a look to /etc/apticron/apticron.conf.
Apticron will be executed, depending of the requested configuration at 8 p.m. and 2 a.m. If you want to change this schedule, please have a look to the cron file /etc/cron.d/apticron.
2018-02-24 21:03:40 +01:00
2019-01-30 19:36:12 +01:00
You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
2019-01-21 13:24:26 +01:00
2019-01-30 19:36:12 +01:00
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/unattended_upgrades_ynh__URL_TAG3__." > mail_to_send
2018-02-24 21:03:40 +01:00
2019-01-30 19:36:12 +01:00
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type="restore"
2019-01-30 19:18:18 +01:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed" --last