1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/agendav_ynh.git synced 2024-09-03 20:36:12 +02:00

[enh] Make use of YunoHost helpers and retrieve SSO path on the fly

This commit is contained in:
Jérôme Lebleu 2016-05-14 11:37:08 +02:00
parent bbadba63b3
commit 425f47a036
7 changed files with 204 additions and 216 deletions

View file

@ -44,7 +44,7 @@ $config['caldav_http_auth_method'] = CURLAUTH_BASIC;
* - Apple Calendar Server: https://host/calendars/users/%u/ * - Apple Calendar Server: https://host/calendars/users/%u/
*/ */
$config['caldav_principal_url'] = 'YNH_CALDAV_PRINCIPAL_URL'; $config['caldav_principal_url'] = '{PRINCIPAL_URL}';
/* /*
* CalDAV calendars URL template * CalDAV calendars URL template
@ -59,7 +59,7 @@ $config['caldav_principal_url'] = 'YNH_CALDAV_PRINCIPAL_URL';
* - Apple Calendar Server: https://host/calendars/users/%s/ * - Apple Calendar Server: https://host/calendars/users/%s/
*/ */
$config['caldav_calendar_url'] = 'YNH_CALDAV_CALENDAR_URL'; $config['caldav_calendar_url'] = '{CALENDAR_URL}';
/* /*
* Public CalDAV URL for calendars * Public CalDAV URL for calendars

View file

@ -20,7 +20,7 @@ require_once('defaults.php');
| path to your installation. | path to your installation.
| |
*/ */
$config['base_url'] = 'https://YNH_DOMAINYNH_WWW_PATH/'; $config['base_url'] = 'https://{DOMAIN}{PATH}/';
/* /*
@ -50,7 +50,7 @@ $config['show_in_log']= array('ERROR','INFO','AUTHERR', 'AUTHOK');
| Use a full server path with trailing slash. | Use a full server path with trailing slash.
| |
*/ */
$config['log_path'] = 'YNH_LOG_PATH/'; $config['log_path'] = '{LOGDIR}/';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -61,7 +61,7 @@ $config['log_path'] = 'YNH_LOG_PATH/';
| MUST set an encryption key. See the user guide for info. | MUST set an encryption key. See the user guide for info.
| |
*/ */
$config['encryption_key'] = 'YNH_ENCRYPT_KEY'; $config['encryption_key'] = '{ENCRYPTKEY}';
/* /*
@ -75,8 +75,8 @@ $config['encryption_key'] = 'YNH_ENCRYPT_KEY';
| 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists. | 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists.
| |
*/ */
$config['cookie_prefix'] = "YNH_COOKIE_PREFIX"; $config['cookie_prefix'] = "{COOKIE_PREFIX}";
$config['cookie_domain'] = "YNH_COOKIE_DOMAIN"; $config['cookie_domain'] = "{COOKIE_DOMAIN}";
$config['cookie_path'] = "/"; $config['cookie_path'] = "/";
$config['cookie_secure'] = TRUE; $config['cookie_secure'] = TRUE;
@ -131,7 +131,8 @@ $config['footer'] = 'Powered by Yunohost';
| Leave empty if you want to redirect to login page | Leave empty if you want to redirect to login page
| |
*/ */
$config['logout_redirect_to'] = 'YNH_LOGOUT_REDIRECT_TO'; $main_domain = exec('cat /etc/yunohost/current_host');
$config['logout_redirect_to'] = 'https://'.$main_domain.'/yunohost/sso/?action=logout';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -166,7 +167,7 @@ $config['show_public_caldav_url'] = FALSE;
| than en. | than en.
| |
*/ */
$config['default_language'] = 'YNH_LANG'; $config['default_language'] = '{LANG}';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -258,7 +259,7 @@ $config['default_first_day'] = 1;
| Please, use a valid timezone from http://php.net/timezones | Please, use a valid timezone from http://php.net/timezones
*/ */
$config['default_timezone'] = 'YNH_TIMEZONE'; $config['default_timezone'] = '{TIMEZONE}';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View file

@ -42,9 +42,9 @@ $active_group = 'default';
$active_record = TRUE; $active_record = TRUE;
$db['default']['hostname'] = 'localhost'; $db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'YNH_DB_USER'; $db['default']['username'] = '{DBUSER}';
$db['default']['password'] = 'YNH_DB_PWD'; $db['default']['password'] = '{DBPASS}';
$db['default']['database'] = 'YNH_DB_NAME'; $db['default']['database'] = '{DBNAME}';
$db['default']['dbdriver'] = 'mysql'; $db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = ''; $db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE; $db['default']['pconnect'] = TRUE;
@ -59,4 +59,4 @@ $db['default']['stricton'] = FALSE;
/* End of file database.php */ /* End of file database.php */
/* Location: ./application/config/database.php */ /* Location: ./application/config/database.php */

View file

@ -1,20 +1,20 @@
location YNH_WWW_PATH { location {LOCATION} {
alias YNH_ALIAS/; alias {DESTDIR}/web/public;
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
index index.php; index index.php;
try_files $uri $uri/ index.php; try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }

View file

@ -1,117 +1,104 @@
#!/bin/bash #!/bin/bash
set -e
# Retrieve arguments # Retrieve arguments
domain=$1 domain=$1
path=$2 path=${2%/}
# Source app helpers
. /usr/share/yunohost/helpers
# Set app specific variables
app="agendav"
dbname=$app
dbuser=$app
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl $domain$path -a agendav sudo yunohost app checkurl "${domain}${path}" -a "$app" \
if [[ ! $? -eq 0 ]]; then || exit 1
echo "Error : $domain$path is not available"
exit 1
fi
baikal=0 # Check destination directory
radicale=0 DESTDIR="/var/www/${app}"
[[ -d "$DESTDIR" ]] && ynh_die \
"The destination directory '${DESTDIR}' already exists.\
You should safely delete it before installing this app."
sudo yunohost app list -f baikal --json | grep '"installed": true' && baikal=1 # Check whether Baïkal or Radicale is installed
sudo yunohost app list -f radicale --json | grep '"installed": true' && radicale=1 if sudo yunohost app list --installed -f baikal | grep -q id ; then
caldav_app="baikal"
if [ "$baikal" == "1" ] ; then caldav_principal_path="/cal.php/%u/"
echo "Detected Baikal" caldav_calendar_path="/cal.php/calendars/%s/"
baikal=1 elif sudo yunohost app list --installed -f radicale | grep -q id ; then
caldavapp=baikal caldav_app="radicale"
elif [ "$radicale" == "1" ] ; then caldav_principal_path="/%u/"
echo "Detected Radicale" caldav_calendar_path="/%s/"
radicale=1
caldavapp=radicale
else else
echo "Error : You must install Baikal or Radicale before" ynh_die "You must install Baïkal or Radicale before"
exit 1
fi fi
# Install dependencies # Install dependencies
sudo apt-get update ynh_package_is_installed "php5-cli" \
sudo apt-get install php5-cli -y || ynh_package_install "php5-cli"
# Generate random password # Generate random password and encryption key
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p') dbpass=$(ynh_string_random)
encryptkey=$(ynh_string_random 24)
# Use 'agendav' as database name and user # Initialize database
db_user=agendav ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" \
# Initialize database and store mysql password for upgrade < "../sources/sql/mysql.schema.sql"
sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../sources/sql/mysql.schema.sql)
sudo yunohost app setting agendav mysqlpwd -v $db_pwd
# Copy files to the right place # Copy files to the right place
final_path=/var/www/agendav sudo cp -r ../sources "$DESTDIR"
sudo mkdir -p $final_path
sudo cp -r ../sources/* $final_path
sudo chown -R admin: $final_path # CalDAV config
currentpath=$(pwd) caldav_domain=$(ynh_app_setting_get "$caldav_app" domain)
cd $final_path/web/application && ln -s ../config config && cd $currentpath caldav_path=$(ynh_app_setting_get "$caldav_app" path)
caldav_url="https://${caldav_domain}${caldav_path%/}"
sed -i "s@{PRINCIPAL_URL}@${caldav_url}${caldav_principal_path}@g" \
../conf/caldav.php
sed -i "s@{CALENDAR_URL}@${caldav_url}${caldav_calendar_path}@g" \
../conf/caldav.php
# caldav config # Database config
caldavdomain=$(sudo yunohost app setting $caldavapp domain) sed -i "s/{DBUSER}/${dbuser}/g" ../conf/database.php
caldavpath=$(sudo yunohost app setting $caldavapp path) sed -i "s/{DBPASS}/${dbpass}/g" ../conf/database.php
caldavpath=${caldavpath%/} sed -i "s/{DBNAME}/${dbname}/g" ../conf/database.php
if [ $baikal -eq 1 ]; then
caldav_principal_url="https://$caldavdomain$caldavpath/cal.php/%u/"
caldav_calendar_url="https://$caldavdomain$caldavpath/cal.php/calendars/%s/"
elif [ $radicale -eq 1 ]; then
caldav_principal_url="https://$caldavdomain$caldavpath/%u/"
caldav_calendar_url="https://$caldavdomain$caldavpath/%s/"
fi
echo "----- $caldav_principal_url"
sed -i "s@YNH_CALDAV_PRINCIPAL_URL@$caldav_principal_url@g" ../conf/caldav.php
sed -i "s@YNH_CALDAV_CALENDAR_URL@$caldav_calendar_url@g" ../conf/caldav.php
# database config # Main config
sed -i "s/YNH_DB_USER/$db_user/g" ../conf/database.php LOGDIR=/var/log/agendav
sed -i "s/YNH_DB_PWD/$db_pwd/g" ../conf/database.php lang=${LANG/.*/}
sed -i "s/YNH_DB_NAME/$db_user/g" ../conf/database.php sed -i "s@{DOMAIN}@${domain}@g" ../conf/config.php
sed -i "s@{PATH}@${path}@g" ../conf/config.php
sed -i "s@{LOGDIR}@${LOGDIR}@g" ../conf/config.php
sed -i "s/{ENCRYPTKEY}/${encryptkey}/g" ../conf/config.php
sed -i "s@{COOKIE_PREFIX}@${path#/}@g" ../conf/config.php
sed -i "s@{COOKIE_DOMAIN}@${domain}@g" ../conf/config.php
sed -i "s@{LANG}@${lang:-en_EN}@g" ../conf/config.php
sed -i "s@{TIMEZONE}@$(cat /etc/timezone)@g" ../conf/config.php
# main config # Copy config files and set permissions
sed -i "s@YNH_DOMAIN@$domain@g" ../conf/config.php sudo cp ../conf/{config,database,caldav}.php "${DESTDIR}/web/config/"
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/config.php (cd "$DESTDIR/web/application" && sudo ln -s ../config config)
logdir=/var/log/agendav sudo chown -hR root: "$DESTDIR"
sudo mkdir -p $logdir
sudo chown www-data: $logdir
sudo chmod 755 $logdir
sed -i "s@YNH_LOG_PATH@$logdir@g" ../conf/config.php
encryptkey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
sudo yunohost app setting agendav encryptkey -v $encryptkey
sed -i "s/YNH_ENCRYPT_KEY/$encryptkey/g" ../conf/config.php
sed -i "s@YNH_COOKIE_PREFIX@${path#/}@g" ../conf/config.php
sed -i "s/YNH_COOKIE_DOMAIN/$domain/g" ../conf/config.php
logout_redirect="https://$domain/yunohost/sso"
sed -i "s@YNH_LOGOUT_REDIRECT_TO@$logout_redirect@g" ../conf/config.php
lang=$(sudo bash -c "echo $LANG | cut -d '.' -f 1")
sed -i "s@YNH_LANG@$lang@g" ../conf/config.php
timezone=$(cat /etc/timezone)
sed -i "s@YNH_TIMEZONE@$timezone@g" ../conf/config.php
# copy config files # Create log directory
sudo cp ../conf/{config.php,database.php,caldav.php} $final_path/web/config/ sudo install -m 750 -o www-data -d "$LOGDIR"
# execute database shema update # Execute database shema update
sudo /var/www/agendav/bin/agendavcli dbupdate sudo /var/www/agendav/bin/agendavcli dbupdate
# Set permissions to agendav directory # Save app settings
sudo chown -R root: $final_path ynh_app_setting_set "$app" encryptkey "$encryptkey"
sudo find $final_path -type f | xargs sudo chmod 644 ynh_app_setting_set "$app" mysqlpwd "$dbpass"
sudo find $final_path -type d | xargs sudo chmod 755
# Modify Nginx configuration file and copy it to Nginx conf directory # Copy and set nginx configuration
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
sed -i "s@YNH_ALIAS@$final_path/web/public@g" ../conf/nginx.conf sed -i "s@{LOCATION}@${path:-/}@g" ../conf/nginx.conf
nginxconf=/etc/nginx/conf.d/$domain.d/agendav.conf sed -i "s@{DESTDIR}@${DESTDIR}@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf $nginxconf sudo cp ../conf/nginx.conf "$nginx_conf"
sudo chown root: $nginxconf
sudo chmod 600 $nginxconf
# Reload Nginx and regenerate SSOwat conf # Reload services
sudo service nginx reload sudo service nginx reload
sudo yunohost app ssowatconf

View file

@ -1,11 +1,23 @@
#!/bin/bash #!/bin/bash
db_user=agendav # Set app specific variables
db_name=agendav app="agendav"
root_pwd=$(sudo cat /etc/yunohost/mysql) dbname=$app
domain=$(sudo yunohost app setting agendav domain) dbuser=$app
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;" # Source app helpers
sudo rm -rf /var/www/agendav . /usr/share/yunohost/helpers
sudo rm -rf /var/log/agendav
sudo rm -f /etc/nginx/conf.d/$domain.d/agendav.conf # Drop MySQL database and user
ynh_mysql_drop_db "$dbname" || true
ynh_mysql_drop_user "$dbuser" || true
# Retrieve domain from app settings
domain=$(ynh_app_setting_get "$app" domain)
# Delete app directory and configurations
sudo rm -rf "/var/www/${app}" "/var/log/${app}"
[[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
# Reload services
sudo service nginx reload || true

View file

@ -1,103 +1,91 @@
#!/bin/bash #!/bin/bash
baikal=0 set -e
radicale=0
if [[ $(sudo yunohost app list --json | grep -q '"id": "baikal"') -eq 0 ]]; then
echo "Detected Baikal"
baikal=1
caldavapp=baikal
elif [[ $(sudo yunohost app list --json | grep -q '"id": "radicale"')? -eq 0 ]]; then
echo "Detected Radicale"
radicale=1
caldavapp=radicale
else
echo "Error : You must install Baikal or Radicale before"
exit 1
fi
domain=$(sudo yunohost app setting agendav domain) # Source app helpers
path=$(sudo yunohost app setting agendav path) . /usr/share/yunohost/helpers
# Set app specific variables
app="agendav"
dbname=$app
dbuser=$app
# Retrieve arguments
domain=$(ynh_app_setting_get "$app" domain)
path=$(ynh_app_setting_get "$app" path)
path=${path%/} path=${path%/}
db_user=agendav dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
db_pwd=$(sudo yunohost app setting agendav mysqlpwd) encryptkey=$(ynh_app_setting_get "$app" encryptkey)
db_name=agendav
encryptkey=$(sudo yunohost app setting agendav encryptkey) # Check destination directory
DESTDIR="/var/www/$app"
[[ ! -d $DESTDIR ]] && ynh_die \
"The destination directory '$DESTDIR' does not exist.\
The app is not correctly installed, you should remove it first."
# Check whether Baïkal or Radicale is installed
if sudo yunohost app list --installed -f baikal | grep -q id ; then
caldav_app="baikal"
caldav_principal_path="/cal.php/%u/"
caldav_calendar_path="/cal.php/calendars/%s/"
elif sudo yunohost app list --installed -f radicale | grep -q id ; then
caldav_app="radicale"
caldav_principal_path="/%u/"
caldav_calendar_path="/%s/"
else
ynh_die "You must install Baïkal or Radicale before"
fi
# Install dependencies # Install dependencies
sudo apt-get update ynh_package_is_installed "php5-cli" \
sudo apt-get install php5-cli -y || ynh_package_install "php5-cli"
# Clean up existing files and copy new files to the right place # Clean up existing files and copy new files to the right place
final_path=/var/www/agendav sudo rm -rf "$DESTDIR"
sudo rm -rf $final_path sudo cp -r ../sources "$DESTDIR"
sudo mkdir -p $final_path
sudo cp -r ../sources/* $final_path
sudo chown -R admin: $final_path # CalDAV config
currentpath=$(pwd) caldav_domain=$(ynh_app_setting_get "$caldav_app" domain)
cd $final_path/web/application && ln -s ../config config && cd $currentpath caldav_path=$(ynh_app_setting_get "$caldav_app" path)
caldav_url="https://${caldav_domain}${caldav_path%/}"
sed -i "s@{PRINCIPAL_URL}@${caldav_url}${caldav_principal_path}@g" \
../conf/caldav.php
sed -i "s@{CALENDAR_URL}@${caldav_url}${caldav_calendar_path}@g" \
../conf/caldav.php
# caldav config # Database config
caldavdomain=$(sudo yunohost app setting $caldavapp domain) sed -i "s/{DBUSER}/${dbuser}/g" ../conf/database.php
caldavpath=$(sudo yunohost app setting $caldavapp path) sed -i "s/{DBPASS}/${dbpass}/g" ../conf/database.php
caldavpath=${caldavpath%/} sed -i "s/{DBNAME}/${dbname}/g" ../conf/database.php
if [ $baikal -eq 1 ]; then
caldav_principal_url="https://$caldavdomain$caldavpath/cal.php/%u/"
caldav_calendar_url="https://$caldavdomain$caldavpath/cal.php/calendars/%s/"
elif [ $radicale -eq 1 ]; then
caldav_principal_url="https://$caldavdomain$caldavpath/%u/"
caldav_calendar_url="https://$caldavdomain$caldavpath/%s/"
fi
echo "----- $caldav_principal_url"
sed -i "s@YNH_CALDAV_PRINCIPAL_URL@$caldav_principal_url@g" ../conf/caldav.php
sed -i "s@YNH_CALDAV_CALENDAR_URL@$caldav_calendar_url@g" ../conf/caldav.php
radicale_path=${radicale_path%/} # Main config
sed -i "s@YNH_DOMAIN@$domain@g" ../conf/caldav.php LOGDIR=/var/log/agendav
sed -i "s@YNH_RADICALE_PATH@$radicale_path@g" ../conf/caldav.php lang=${LANG/.*/}
sed -i "s@{DOMAIN}@${domain}@g" ../conf/config.php
sed -i "s@{PATH}@${path}@g" ../conf/config.php
sed -i "s@{LOGDIR}@${LOGDIR}@g" ../conf/config.php
sed -i "s/{ENCRYPTKEY}/${encryptkey}/g" ../conf/config.php
sed -i "s@{COOKIE_PREFIX}@${path#/}@g" ../conf/config.php
sed -i "s@{COOKIE_DOMAIN}@${domain}@g" ../conf/config.php
sed -i "s@{LANG}@${lang:-en_EN}@g" ../conf/config.php
sed -i "s@{TIMEZONE}@$(cat /etc/timezone)@g" ../conf/config.php
# database config # Copy config files and set permissions
sed -i "s/YNH_DB_USER/$db_user/g" ../conf/database.php sudo cp ../conf/{config,database,caldav}.php "${DESTDIR}/web/config/"
sed -i "s/YNH_DB_PWD/$db_pwd/g" ../conf/database.php (cd "$DESTDIR/web/application" && sudo ln -s ../config config)
sed -i "s/YNH_DB_NAME/$db_user/g" ../conf/database.php sudo chown -hR root: "$DESTDIR"
# main config # Create log directory
sed -i "s@YNH_DOMAIN@$domain@g" ../conf/config.php sudo install -m 750 -o www-data -d "$LOGDIR"
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/config.php
logdir=/var/log/agendav
sudo mkdir -p $logdir
sudo chown www-data: $logdir
sudo chmod 755 $logdir
sed -i "s@YNH_LOG_PATH@$logdir@g" ../conf/config.php
sed -i "s/YNH_ENCRYPT_KEY/$encryptkey/g" ../conf/config.php
sed -i "s@YNH_COOKIE_PREFIX@${path#/}@g" ../conf/config.php
sed -i "s/YNH_COOKIE_DOMAIN/$domain/g" ../conf/config.php
logout_redirect="https://$domain/yunohost/sso"
sed -i "s@YNH_LOGOUT_REDIRECT_TO@$logout_redirect@g" ../conf/config.php
lang=$(sudo bash -c "echo $LANG | cut -d '.' -f 1")
sed -i "s@YNH_LANG@$lang@g" ../conf/config.php
timezone=$(cat /etc/timezone)
sed -i "s@YNH_TIMEZONE@$timezone@g" ../conf/config.php
# copy config files # Execute database shema update
sudo cp ../conf/{config.php,database.php,caldav.php} $final_path/web/config/
# execute database shema update
sudo /var/www/agendav/bin/agendavcli dbupdate sudo /var/www/agendav/bin/agendavcli dbupdate
# Set permissions to agendav directory # Copy and set nginx configuration
sudo chown -R root: $final_path nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
sudo find $final_path -type f | xargs sudo chmod 644 sed -i "s@{LOCATION}@${path:-/}@g" ../conf/nginx.conf
sudo find $final_path -type d | xargs sudo chmod 755 sed -i "s@{DESTDIR}@${DESTDIR}@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf "$nginx_conf"
# Modify Nginx configuration file and copy it to Nginx conf directory # Reload services
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf sudo service nginx reload || true
sed -i "s@YNH_ALIAS@$final_path/web/public@g" ../conf/nginx.conf
nginxconf=/etc/nginx/conf.d/$domain.d/agendav.conf
sudo cp ../conf/nginx.conf $nginxconf
sudo chown root: $nginxconf
sudo chmod 600 $nginxconf
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app ssowatconf