test_apps/backup_recommended_app_ynh/scripts/install
2017-04-28 17:46:46 +02:00

35 lines
891 B
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
# Source app helpers
source /usr/share/yunohost/helpers
# Check domain/path availability
sudo yunohost app checkurl $domain/$path -a $app
# 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