mirror of
https://github.com/YunoHost/test_apps.git
synced 2024-09-03 20:06:29 +02:00
Bump legacy app to less-legacy helpers (c.f. upcoming bullseye legacy drop)
This commit is contained in:
parent
5adea3f2dc
commit
2c413ce9e2
3 changed files with 17 additions and 13 deletions
|
@ -7,9 +7,9 @@ source /usr/share/yunohost/helpers
|
|||
# Retrieve parameters
|
||||
|
||||
# Backup directory (location dedicated to the app)
|
||||
backup_dir=$1
|
||||
backup_dir=.
|
||||
# App instance name
|
||||
app=$2
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
|
||||
# Copy the app files (explicitly specifying the backup dir)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
set -eux
|
||||
|
||||
# Source app helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Retrieve arguments
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
number=$YNH_APP_INSTANCE_NUMBER
|
||||
|
@ -8,7 +11,7 @@ path=$YNH_APP_ARG_PATH
|
|||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain/$path -a $app
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path
|
||||
|
||||
# Check folder availability
|
||||
test ! -e "/var/www/$app/"
|
||||
|
@ -22,8 +25,7 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
|||
sudo mkdir /var/www/$app
|
||||
sudo cp ../conf/index.html /var/www/$app
|
||||
|
||||
sudo yunohost app checkport 12345
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
if ! ynh_port_available 12345; then
|
||||
echo "Ogod noez the port 12345 aint available!!"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -31,8 +33,7 @@ fi
|
|||
# Create a dummy mysql db
|
||||
db_user=$app
|
||||
db_pwd="yoloswag42"
|
||||
sudo yunohost app initdb "$db_user" -p $db_pwd
|
||||
sudo yunohost app setting $app mysqlpwd -v $db_pwd
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_user --db_pwd=$db_pwd
|
||||
|
||||
# Other custom stuff
|
||||
sudo cp ../sources/importantfile /etc/
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
# No set -eu for this particular app restore script (see comment near the end)
|
||||
#set -eu
|
||||
|
||||
restore_dir=$1
|
||||
app=$2
|
||||
# Source app helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
restore_dir=.
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Get old parameter of the app
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
|
@ -18,8 +21,7 @@ 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
|
||||
if ! ynh_port_available 12345; then
|
||||
echo "Ogod noez the port 12345 aint available!!"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -27,8 +29,9 @@ fi
|
|||
# Restore the database
|
||||
db_user=$app
|
||||
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"
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_user --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_user --database=$db_name < ${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...
|
||||
sudo rm ${restore_dir}/db.sql
|
||||
|
|
Loading…
Add table
Reference in a new issue