2017-04-28 17:46:46 +02:00
|
|
|
set -eux
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
number=$YNH_APP_INSTANCE_NUMBER
|
|
|
|
domain=$YNH_APP_ARG_DOMAIN
|
|
|
|
path=$YNH_APP_ARG_PATH
|
2017-05-04 14:24:02 +02:00
|
|
|
helper_to_test=$YNH_APP_ARG_HELPER_TO_TEST
|
2017-04-28 17:46:46 +02:00
|
|
|
|
|
|
|
# Source app helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Check domain/path availability
|
|
|
|
sudo yunohost app checkurl $domain/$path -a $app
|
|
|
|
|
2017-05-04 14:24:02 +02:00
|
|
|
# Register mode of restoration
|
|
|
|
ynh_app_setting_set $app helper_to_test $helper_to_test
|
|
|
|
|
2017-04-28 17:46:46 +02:00
|
|
|
# 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
|