mirror of
https://github.com/YunoHost/test_apps.git
synced 2024-09-03 20:06:29 +02:00
32 lines
739 B
Text
32 lines
739 B
Text
|
#!/bin/bash
|
||
|
set -eu
|
||
|
|
||
|
# Source app helpers
|
||
|
source /usr/share/yunohost/helpers
|
||
|
|
||
|
restore_dir=$1
|
||
|
app=$2
|
||
|
|
||
|
# Get old parameter of the app
|
||
|
domain=$(ynh_app_setting_get $app domain)
|
||
|
path=$(ynh_app_setting_get $app path)
|
||
|
|
||
|
# Restore www directory
|
||
|
ynh_restore_file /var/www/$app
|
||
|
|
||
|
# Restore nginx conf
|
||
|
ynh_restore_file /etc/nginx/conf.d/$domain.d/$app.conf
|
||
|
|
||
|
# Restore custom file (with different source/destinations)
|
||
|
ynh_restore_file /etc/yoloswag /etc/importantfile
|
||
|
|
||
|
# Restore the database
|
||
|
db_user=$app
|
||
|
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||
|
ynh_mysql_create_db $db_user $db_user $db_pwd
|
||
|
sudo su -c "mysql -u $db_user -p$db_pwd $app < ${restore_dir}/db.sql"
|
||
|
|
||
|
# Reload/reconfigure services
|
||
|
sudo service nginx reload
|
||
|
sudo yunohost app ssowatconf
|