mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
321d6cb2d9
Instead of doing it by hand. Also we now rely on the fact ynh automatically runs uninstall script if the install fails. So no more need for manual cleanup.
42 lines
1 KiB
Bash
42 lines
1 KiB
Bash
#!/bin/bash
|
|
|
|
# Source YunoHost helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
ynh_abort_if_errors
|
|
|
|
# Get multi-instances specific variables
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
# Set app specific variables
|
|
dbname=$app
|
|
dbuser=$app
|
|
|
|
INSTALL_DIR=/opt/yunohost/ihatemoney
|
|
|
|
# Retrieve app settings
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
path=$(ynh_app_setting_get "$app" path)
|
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
|
|
|
# Source local utils
|
|
if [ ! -e _common.sh ]; then
|
|
# Fetch the local helpers files, because unavail to restore script
|
|
sudo cp ../settings/scripts/_common.sh ./_common.sh
|
|
sudo chmod a+rx _common.sh
|
|
fi
|
|
|
|
source _common.sh
|
|
|
|
# Backup conf files
|
|
mkdir ./conf
|
|
ynh_backup "$nginx_conf_path" "conf/nginx.conf"
|
|
ynh_backup "$gunicorn_conf_path" "conf/gunicorn.conf.py"
|
|
ynh_backup "$supervisor_conf_path" "conf/supervisor.conf"
|
|
ynh_backup "$ihatemoney_conf_path" "conf/ihatemoney.cfg"
|
|
|
|
# Dump the database
|
|
mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./db.sql
|
|
|
|
# Backup code and venv
|
|
ynh_backup "$INSTALL_DIR" "install_dir"
|