test_apps/backup_recommended_app_ynh/scripts/install
2021-06-04 18:09:47 +02:00

39 lines
1 KiB
Text

set -eux
# Retrieve arguments
app=$YNH_APP_INSTANCE_NAME
number=$YNH_APP_INSTANCE_NUMBER
domain=$YNH_APP_ARG_DOMAIN
path=$YNH_APP_ARG_PATH
helper_to_test=$YNH_APP_ARG_HELPER_TO_TEST
# Source app helpers
source /usr/share/yunohost/helpers
# Check domain/path availability
ynh_webpath_register --app=$app --domain=$domain --path_url=$path
# Register mode of restoration
ynh_app_setting_set $app helper_to_test $helper_to_test
# Add config for nginx
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sudo sed -i "s@FOLDER@$app/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Make directory for app web data
sudo mkdir -p /var/www/$app
sudo cp ../conf/index.html /var/www/$app
# 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
# Other custom stuff
sudo cp ../sources/importantfile /etc/
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
#sudo yunohost app ssowatconf