From c795c578d781deab944f8ab4a29efa0cdaf5015a Mon Sep 17 00:00:00 2001 From: Rafi59 Date: Fri, 2 Nov 2018 18:03:53 +0100 Subject: [PATCH] Add upgrade --- scripts/upgrade | 58 ++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 2dffa9f..3d706e4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -8,46 +8,42 @@ 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) -path_url=$(ynh_app_setting_get "$app" path_url) -admin=$(ynh_app_setting_get "$app" admin) +password=$(ynh_app_setting_get "$app" password) is_public=$(ynh_app_setting_get "$app" is_public) -language=$(ynh_app_setting_get "$app" language) +nextclouddomain=$(ynh_app_setting_get "$app" nextclouddomain) -# Remove trailing "/" for next commands -path_url=${path_url%/} - -# 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 -# 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 +#================================================= +# 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 + -### 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 ### # If app is public, add url to SSOWat conf as skipped_uris if [[ $is_public -eq 1 ]]; then @@ -56,4 +52,6 @@ if [[ $is_public -eq 1 ]]; then fi # Reload nginx service -sudo service nginx reload +systemctl restart nginx +systemctl restart loolwsd +