mirror of
https://github.com/YunoHost-Apps/laverna_ynh.git
synced 2024-09-03 19:36:06 +02:00
76 lines
2.3 KiB
Bash
Executable file
76 lines
2.3 KiB
Bash
Executable file
#!/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
|
||
|
||
# Source YunoHost helpers
|
||
source /usr/share/yunohost/helpers
|
||
|
||
# Retrieve app settings
|
||
domain=$(ynh_app_setting_get "$app" domain)
|
||
path=$(ynh_app_setting_get "$app" path)
|
||
admin=$(ynh_app_setting_get "$app" admin)
|
||
is_public=$(ynh_app_setting_get "$app" is_public)
|
||
language=$(ynh_app_setting_get "$app" language)
|
||
|
||
# Remove trailing "/" for next commands
|
||
path=${path%/}
|
||
|
||
# Copy source files
|
||
src_path=/var/www/$app
|
||
mkdir -p $src_path
|
||
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
|
||
|
||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||
nginx_conf=../conf/nginx.conf
|
||
sed -i "s@YNH_WWW_PATH@$path@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
|
||
cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||
|
||
### 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 ###
|
||
|
||
#=================================================
|
||
# SETUP SSOWAT
|
||
#=================================================
|
||
ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1
|
||
|
||
# Make app public if necessary
|
||
if [ $is_public -eq 1 ]
|
||
then
|
||
# unprotected_uris allows SSO credentials to be passed anyway
|
||
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
||
fi
|
||
|
||
#=================================================
|
||
# RELOAD NGINX
|
||
#=================================================
|
||
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||
|
||
ynh_systemd_action --service_name=nginx --action=reload
|
||
|
||
#=================================================
|
||
# END OF SCRIPT
|
||
#=================================================
|
||
|
||
ynh_script_progression --message="Upgrade of $app completed" --time --last
|
||
|