#!/bin/bash #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." ynh_secure_remove --file="/etc/apt/sources.list.d/onlyoffice.list" ynh_secure_remove --file="/etc/apt/sources.list.d/nodesource.list" #================================================= # CONFIGURE ONLYOFFICE #================================================= ynh_script_progression --message="Upgrading OnlyOffice..." ynh_backup_if_checksum_is_different --file="/etc/onlyoffice/documentserver/default.json" _install_msfonts_deb _install_onlyoffice_deb #================================================= # UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating a configuration file..." ynh_backup_if_checksum_is_different --file="/etc/onlyoffice/documentserver/default.json" ynh_replace_string --target_file="/etc/onlyoffice/documentserver/default.json" \ --match_string="\"rejectUnauthorized\": true" \ --replace_string="\"rejectUnauthorized\": false" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="/etc/onlyoffice/documentserver/default.json" #================================================= # REGENERATE FONTS #================================================= ynh_script_progression --message="Generating fonts..." /usr/bin/documentserver-generate-allfonts.sh 2>/dev/null #================================================= # SECURE FILES AND DIRECTORIES #================================================= # Set permissions to app files chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R ds:ds "$install_dir" #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= for service in "ds-converter" "ds-docservice" "ds-metrics"; do yunohost service add "$service" done #================================================= # START SERVICES #================================================= for service in "ds-converter" "ds-docservice" "ds-metrics"; do ynh_systemd_action --action=restart --service_name="$service" done #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed"