mirror of
https://github.com/YunoHost/test_apps.git
synced 2024-09-03 20:06:29 +02:00
Deprecated practice of using to fetch script arguments
This commit is contained in:
parent
1c35a5881b
commit
97ca65f3aa
2 changed files with 7 additions and 20 deletions
|
@ -1,27 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# Source app helpers
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve parameters
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Backup directory (location dedicated to the app)
|
|
||||||
backup_dir=$1
|
|
||||||
# App instance name
|
|
||||||
app=$2
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
|
||||||
# Backup the app files
|
# Backup the app files
|
||||||
#sudo mkdir -p "${backup_dir}/var/www"
|
|
||||||
ynh_backup /var/www/$app
|
ynh_backup /var/www/$app
|
||||||
|
|
||||||
# Backup the conf files
|
# Backup the conf files
|
||||||
#sudo mkdir -p "${backup_dir}/conf"
|
|
||||||
ynh_backup /etc/nginx/conf.d/$domain.d/$app.conf
|
ynh_backup /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
# Backup the custom file to a different location
|
# Backup the custom file to a different location
|
||||||
ynh_backup /etc/importantfile /etc/yoloswag
|
ynh_backup /etc/importantfile /etc/yoloswag
|
||||||
|
|
||||||
# Backup db
|
# Backup db
|
||||||
ynh_mysql_dump_db $app > "${backup_dir}/db.sql"
|
ynh_mysql_dump_db $app > db.sql
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# Source app helpers
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
restore_dir=$1
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
app=$2
|
|
||||||
|
|
||||||
# Get old parameter of the app
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
path=$(ynh_app_setting_get $app path)
|
path=$(ynh_app_setting_get $app path)
|
||||||
helper_to_test=$(ynh_app_setting_get $app helper_to_test)
|
helper_to_test=$(ynh_app_setting_get $app helper_to_test)
|
||||||
|
@ -29,10 +25,9 @@ fi
|
||||||
|
|
||||||
# Restore the database
|
# Restore the database
|
||||||
db_user=$app
|
db_user=$app
|
||||||
|
db_name=$app
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
ynh_mysql_create_db $db_user $db_user $db_pwd
|
ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
|
||||||
sudo su -c "mysql -u $db_user -p$db_pwd $app < ${restore_dir}/db.sql"
|
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql
|
||||||
|
|
||||||
# Reload/reconfigure services
|
systemctl reload nginx
|
||||||
sudo service nginx reload
|
|
||||||
sudo yunohost app ssowatconf
|
|
||||||
|
|
Loading…
Reference in a new issue