1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gogs_ynh.git synced 2024-09-03 20:36:23 +02:00
gogs_ynh/scripts/backup

34 lines
793 B
Text
Raw Normal View History

2016-08-15 15:38:50 +02:00
#!/bin/bash
set -eu
# Set app specific variables
app=${APPNAME:-gogs}
2016-08-15 15:38:50 +02:00
dbname=$app
dbuser=$app
# Source app helpers
source /usr/share/yunohost/helpers
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
repo_path=$(ynh_app_setting_get "$app" repopath)
# Copy the app source files
DESTDIR="/opt/$app"
ynh_backup "$DESTDIR" "www"
# Copy the data files
DATADIR="/home/$app"
ynh_backup "$DATADIR" "data"
# Copy the conf files
mkdir ./conf
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "conf/nginx.conf"
ynh_backup "/etc/logrotate.d/${app}" "conf/logrotate"
ynh_backup "/etc/systemd/system/${app}.service" "conf/systemd.service"
# Dump the database
mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./db.sql