mirror of
https://github.com/YunoHost/test_apps.git
synced 2024-09-03 20:06:29 +02:00
Make the legacy app even legacier lolz
This commit is contained in:
parent
e9008f65f7
commit
683830ce52
2 changed files with 18 additions and 14 deletions
|
@ -6,9 +6,6 @@ number=$YNH_APP_INSTANCE_NUMBER
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
|
||||
# Source app helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain/$path -a $app
|
||||
|
||||
|
@ -21,11 +18,17 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
|||
sudo mkdir -p /var/www/$app
|
||||
sudo cp ../conf/index.html /var/www/$app
|
||||
|
||||
sudo yunohost app checkport 12345
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
echo "Ogod noez the port 12345 aint available!!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create a dummy mysql db
|
||||
db_user=$app
|
||||
db_pwd="yoloswag42"
|
||||
ynh_mysql_create_db "$db_user" "$db_user" $db_pwd
|
||||
ynh_app_setting_set $app mysqlpwd $db_pwd
|
||||
sudo yunohost app initdb "$db_user" -p $db_pwd
|
||||
sudo yunohost app setting $app mysqlpwd -v $db_pwd
|
||||
|
||||
# Other custom stuff
|
||||
sudo cp ../sources/importantfile /etc/
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# No set -eu for this particular app restore script (see comment near the end)
|
||||
#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)
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
path=$(sudo yunohost app setting $app path)
|
||||
|
||||
# Restore www directory
|
||||
sudo cp -a "${restore_dir}/var/www/$app" /var/www/$app
|
||||
|
@ -23,10 +18,16 @@ sudo cp -a "${restore_dir}/conf/nginx.conf" $nginx_conf
|
|||
# Restore custom file
|
||||
sudo cp -a "${restore_dir}/importantfile" /etc/importantfile
|
||||
|
||||
sudo yunohost app checkport 12345
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
echo "Ogod noez the port 12345 aint available!!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Restore the database
|
||||
db_user=$app
|
||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||
ynh_mysql_create_db $db_user $db_user $db_pwd
|
||||
db_pwd=$(sudo yunohost app setting $app mysqlpwd)
|
||||
sudo yunohost app initdb $db_user -p $db_pwd
|
||||
sudo su -c "mysql -u $db_user -p$db_pwd $app < ${restore_dir}/db.sql"
|
||||
# Some scripts wanted to delete the db.sql... This won't make the script crash
|
||||
# even if restore_dir is in read-only as long as there's no set -eu activated...
|
||||
|
|
Loading…
Reference in a new issue