2016-08-15 15:38:50 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-02-19 22:24:20 +01:00
|
|
|
set -euo pipefail
|
2016-08-15 15:38:50 +02:00
|
|
|
|
|
|
|
# Set app specific variables
|
2016-10-18 00:01:49 +02:00
|
|
|
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
|