scratch_ynh/scripts/upgrade
liberodark 25c23d8d0b First
2018-11-29 11:55:24 +01:00

57 lines
1.5 KiB
Bash

#!/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
source _common.sh
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
password=$(ynh_app_setting_get "$app" password)
is_public=$(ynh_app_setting_get "$app" is_public)
nextclouddomain=$(ynh_app_setting_get "$app" nextclouddomain)
# 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
#=================================================
# UPGRADE COLLABORA
#=================================================
ynh_package_update
ynh_install_app_dependencies loolwsd code-brand
#=================================================
# NGINX CONFIGURATION
#=================================================
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# UPGRADE CONFIG
#=================================================
cp -a ../conf/loolwsd.xml /etc/loolwsd
ynh_replace_string "__NEXTCLOUDDOMAIN__" "$nextcloud_domain" "/etc/loolwsd/loolwsd.xml"
ynh_replace_string "__PASSWORD__" "$password" "/etc/loolwsd/loolwsd.xml"
systemctl restart loolwsd
# 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 "/"
fi
# Reload nginx service
systemctl restart nginx
systemctl restart loolwsd