You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.8 KiB
Plaintext

10 years ago
#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
# See comments in install script
app=$YNH_APP_INSTANCE_NAME
10 years ago
# Source YunoHost helpers
source /usr/share/yunohost/helpers
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
path_url=$(ynh_app_setting_get "$app" path_url)
admin=$(ynh_app_setting_get "$app" admin)
is_public=$(ynh_app_setting_get "$app" is_public)
language=$(ynh_app_setting_get "$app" language)
10 years ago
# Remove trailing "/" for next commands
path_url=${path_url%/}
10 years ago
# Copy source files
src_path=/var/www/$app
sudo mkdir -p $src_path
sudo cp -a ../sources/. $src_path
# Set permissions to app files
# you may need to make some file and/or directory writeable by www-data (nginx user)
sudo chown -R root: $src_path
10 years ago
# Modify Nginx configuration file and copy it to Nginx conf directory
nginx_conf=../conf/nginx.conf
sed -i "s@YNH_WWW_PATH@$path_url@g" $nginx_conf
sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf
# If a dedicated php-fpm process is used:
#
# sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
10 years ago
### PHP (remove if not used) ###
# If a dedicated php-fpm process is used:
# # Modify PHP-FPM pool configuration and copy it to the pool directory
# sed -i "s@YNH_WWW_APP@$app@g" ../conf/php-fpm.conf
# sed -i "s@YNH_WWW_ALIAS@$src_path/@g" ../conf/php-fpm.conf
# finalphpconf=/etc/php5/fpm/pool.d/$app.conf
# sudo cp ../conf/php-fpm.conf $finalphpconf
# sudo chown root: $finalphpconf
# sudo chmod 644 $finalphpconf
# sudo service php5-fpm restart
### PHP end ###
10 years ago
# If app is public, add url to SSOWat conf as skipped_uris
if [[ $is_public -eq 1 ]]; then
# See install script
ynh_app_setting_set "$app" unprotected_uris "/"
10 years ago
fi
# Reload nginx service
10 years ago
sudo service nginx reload