[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot
2024-08-30 22:57:28 +02:00
committed by Josué Tille
parent 9e748220af
commit a9647ffbf1
8 changed files with 116 additions and 144 deletions

View File

@ -8,41 +8,37 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
if systemctl is-active "$app".service --quiet; then
ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'"
ynh_print_warn "It's hightly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'"
fi
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message='Declaring files to be backed up...'
ynh_print_info 'Declaring files to be backed up...'
# Copy the app source files
ynh_backup --src_path="$install_dir"
ynh_backup "$install_dir"
# Copy the data files
ynh_backup --src_path="$data_dir" --is_big=1
ynh_backup "$data_dir"
# Copy the conf files
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
ynh_backup "/etc/fail2ban/jail.d/$app.conf"
ynh_backup "/etc/fail2ban/filter.d/$app.conf"
ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup "/etc/logrotate.d/$app"
ynh_backup --src_path="/etc/systemd/system/$app.service"
ynh_backup "/etc/systemd/system/$app.service"
# Backup logs
ynh_backup --src_path="/var/log/$app"
ynh_backup "/var/log/$app"
# Dump the database
ynh_print_info --message="Backing up the MySQL database"
ynh_mysql_dump_db "$db_name" > ./db.sql
ynh_print_info "Backing up the MySQL database"
ynh_mysql_dump_db > ./db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."