diff --git a/scripts/backup b/scripts/backup index aef132b..490a4b0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -3,36 +3,76 @@ #================================================= # GENERIC START #================================================= - # IMPORT GENERIC HELPERS +#================================================= + +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +ynh_clean_setup () { + true +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors -# Load common variables and helpers +#================================================= +# LOAD SETTINGS +#================================================= +ynh_print_info --message="Loading installation settings..." -source ../settings/scripts/_common.sh +app=$YNH_APP_INSTANCE_NAME # Retrieve app settings -domain=$(ynh_app_setting_get "$app" domain) +domain=$(ynh_app_setting_get --app=$app --key=domain) + +#================================================= +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." #================================================= # STANDARD BACKUP STEPS #================================================= -# Copy the app source files -ynh_backup "$final_path" +ynh_backup --src_path="$final_path" -# Copy the data files -ynh_backup "$DATADIR" +#================================================= +# BACKUP DATA FILES +#================================================= -# Copy the conf files -ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" -ynh_backup "/etc/systemd/system/${app}.service" +ynh_backup --src_path="$DATADIR" -# Backup logs -ynh_backup "/var/log/$app" +#================================================= +# BACKUP THE NGINX CONFIGURATION +#================================================= -# Dump the database -ynh_mysql_dump_db "$dbname" > ./db.sql \ No newline at end of file +ynh_backup --src_path="/etc/nginx/conf.d/${domain}.d/${app}.conf" + +#================================================= +# BACKUP SYSTEMD +#================================================= + +ynh_backup --src_path="/etc/systemd/system/${app}.service" + +#================================================= +# BACKUP VARIOUS FILES +#================================================= + +ynh_backup --src_path="/var/log/$app" + +#================================================= +# BACKUP THE MYSQL DATABASE +#================================================= +ynh_print_info --message="Backing up the MySQL database..." + +ynh_mysql_dump_db "$dbname" > ./db.sql + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index d2a8f2f..6838126 100644 --- a/scripts/install +++ b/scripts/install @@ -90,4 +90,4 @@ yunohost service add "$app" --log "/var/log/$app/$app.log" ynh_use_logrotate "/var/log/$app" # Reload services -ynh_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/gogs.log" +ynh_clean_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/gogs.log"