1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gogs_ynh.git synced 2024-09-03 20:36:23 +02:00
This commit is contained in:
ericgaspar 2020-10-11 23:46:18 +02:00
parent 1390568de3
commit a62b96d9e5
No known key found for this signature in database
GPG key ID: 574F281483054D44
3 changed files with 48 additions and 16 deletions

View file

@ -14,7 +14,6 @@
upgrade=1
upgrade=1 from_commit=aa075b2051ffad7b0b6fef3a9c767376d5bdbfab
upgrade=1 from_commit=1cbec051e1171de5a8ed1e850eb4fb3506114da5
upgrade=1 from_commit=5a706ed246392c1ce39c47a648cb93e2996e80d3
backup_restore=1
multi_instance=1
incorrect_path=0
@ -37,5 +36,3 @@
name=Before multi_instance and refactoring
; commit=1cbec051e1171de5a8ed1e850eb4fb3506114da5
name=From V0.10.18
; commit=5a706ed246392c1ce39c47a648cb93e2996e80d3
name=The oldest package

View file

@ -59,7 +59,7 @@
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public site ?",
"en": "Is it a public site?",
"fr": "Est-ce un site public ?"
},
"default": true

View file

@ -3,35 +3,70 @@
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_abort_if_errors
# Load common variables and helpers
source ../settings/scripts/_common.sh
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
# Copy the app source files
ynh_backup "$final_path"
# Copy the data files
ynh_backup "$DATADIR"
# Copy the conf files
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/${app}.service"
# Backup logs
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup "/var/log/$app"
# Dump the database
ynh_mysql_dump_db "$dbname" > ./db.sql
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."