1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/garradin_ynh.git synced 2024-09-03 18:36:17 +02:00
garradin_ynh/scripts/upgrade

46 lines
1.1 KiB
Text
Raw Normal View History

2017-01-28 23:41:18 +01:00
#!/bin/bash
2017-02-11 23:18:15 +01:00
set -eu
2017-02-11 19:54:05 +01:00
# Source app helpers
source /usr/share/yunohost/helpers
2017-01-28 23:41:18 +01:00
source ./_common
2017-02-11 23:18:15 +01:00
2017-01-28 23:41:18 +01:00
app=$YNH_APP_INSTANCE_NAME
2017-02-11 23:25:24 +01:00
domain=$(ynh_app_setting_get $app domain)
path=$(ynh_app_setting_get $app path)
is_public=$(ynh_app_setting_get $app is_public)
2017-01-28 23:41:18 +01:00
# Remove trailing "/" for next commands
if [[ ! "$path" == "/" ]]; then
path=${path%/}
fi
2017-02-12 11:32:44 +01:00
# Copy files to the right place
2017-01-28 23:41:18 +01:00
final_path=/var/www/$app
sudo mkdir -p $final_path
sudo rm -rf $final_path/*
2017-02-12 11:32:44 +01:00
extract_source $final_path
2017-01-28 23:41:18 +01:00
# Files owned by root, www-data can just read
2017-01-28 23:44:22 +01:00
sudo chown www-data:www-data $final_path -R
sudo chmod 755 $final_path -R
2017-01-28 23:41:18 +01:00
# Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf
sudo cp ../conf/nginx.conf $nginxconf
sudo chown root: $nginxconf
sudo chmod 600 $nginxconf
2017-02-11 19:54:05 +01:00
ynh_app_setting_set "$app" is_public "$is_public"
2017-01-28 23:41:18 +01:00
if [ "$is_public" = "Yes" ];
then
2017-02-11 19:54:05 +01:00
ynh_app_setting_set "$app" unprotected_uris "/"
2017-01-28 23:41:18 +01:00
fi
sudo service nginx reload
sudo yunohost app ssowatconf
2017-02-11 19:54:05 +01:00