1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/onlyoffice_ynh.git synced 2024-09-03 19:56:11 +02:00

Update packagingv2

This commit is contained in:
Salamandar 2024-03-19 11:13:47 +01:00
parent 864e78b0d3
commit 4671f4481a
6 changed files with 79 additions and 412 deletions

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -10,31 +8,13 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_print_info --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE NGINX CONFIGURATION
# BACKUP THE SYSTEM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -46,6 +26,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/onlyoffice"
ynh_backup --src_path="/var/lib/onlyoffice/documentserver/App_Data/cache/files" --not_mandatory
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/var/log/$app/"
#=================================================
# BACKUP THE POSTGRESQL DATABASE
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,65 +7,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
#REMOVEME? old_path=$YNH_APP_OLD_PATH
#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
#REMOVEME? new_path=$YNH_APP_NEW_PATH
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? # Needed for helper "ynh_add_nginx_config"
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
# Add settings here as needed by your application
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
#REMOVEME? change_domain=0
#REMOVEME? if [ "$old_domain" != "$new_domain" ]
then
#REMOVEME? change_domain=1
fi
#REMOVEME? change_path=0
#REMOVEME? if [ "$old_path" != "$new_path" ]
then
#REMOVEME? change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
@ -75,46 +14,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..."
ynh_change_url_nginx_config
#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
#REMOVEME? domain="$old_domain"
#REMOVEME? path="$new_path"
if [ $new_path = "/" ]; then
#REMOVEME? ynh_replace_string --match_string="__SUB_PATH__" --replace_string="" --target_file="../conf/nginx.conf"
else
#REMOVEME? ynh_replace_string --match_string="__SUB_PATH__" --replace_string="$new_path" --target_file="../conf/nginx.conf"
fi
# Create a dedicated NGINX config
#REMOVEME? ynh_add_nginx_config "nextclouddomain"
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path"
#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -17,23 +17,9 @@ jwt_secret=$(ynh_string_random --length=32)
ynh_app_setting_set --app="$app" --key=jwt_secret --value="$jwt_secret"
#=================================================
# NGINX CONFIGURATION
# INSTALL ONLYOFFICE
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
if [ $path = "/" ]; then
path_no_slash=""
else
path_no_slash="$path"
fi
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CONFIGURE ONLYOFFICE
#=================================================
ynh_script_progression --message="Configuring OnlyOffice..."
ynh_script_progression --message="Install OnlyOffice..."
echo onlyoffice-documentserver onlyoffice/ds-port select "$port" | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-host string 127.0.0.1 | debconf-set-selections
@ -42,11 +28,6 @@ echo onlyoffice-documentserver onlyoffice/db-pwd password "$db_pwd" | debconf-se
echo onlyoffice-documentserver onlyoffice/db-name string "$db_name" | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/jwt-secret password "$jwt_secret" | debconf-set-selections
#=================================================
# INSTALL ONLYOFFICE
#=================================================
ynh_script_progression --message="Install OnlyOffice..."
# The OnlyOffice dev had the magnificent idea to add a "nginx restart" during
# the install/configure of their package, which is awful since that will
# restart NGINX and the whole webadmin and maybe even the YunoHost command
@ -63,9 +44,18 @@ ynh_exec_warn_less ynh_install_extra_app_dependencies \
#=================================================
ynh_script_progression --message="Adding $app's configuration file..."
ynh_replace_string --match_string="\"rejectUnauthorized\": true" --replace_string="\"rejectUnauthorized\": false" --target_file="/etc/onlyoffice/documentserver/default.json"
ynh_replace_string --target_file="/etc/onlyoffice/documentserver/default.json" \
--match_string="\"rejectUnauthorized\": true" \
--replace_string="\"rejectUnauthorized\": false"
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
#=================================================
@ -76,11 +66,18 @@ chmod -R o-rwx "$install_dir"
chown -R ds:ds "$install_dir"
#=================================================
# REGENERATE FONTS
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Generating fonts..."
ynh_script_progression --message="Configuring NGINX web server..."
/usr/bin/documentserver-generate-allfonts.sh 2>/dev/null
if [ $path = "/" ]; then
path_no_slash=""
else
path_no_slash="$path"
fi
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# END OF SCRIPT

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,21 +7,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE ONLYOFFICE
#=================================================
@ -40,48 +23,21 @@ ynh_secure_remove --file=/var/lib/dpkg/info/onlyoffice-documentserver.prerm
#ln -s /bin/true /usr/local/bin/supervisorctl
ynh_package_autopurge onlyoffice-documentserver
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the PostgreSQL database..."
# Remove a database if it exists, along with the associated user
#REMOVEME? ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name"
#=================================================
# REMOVE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
#REMOVEME? ynh_remove_app_dependencies
dpkg --configure -a
apt-key del "E09C A29F 6E17 8040 EF22 B409 8320 CA65 CB2D E8E5" 2>/dev/null
#=================================================
# REMOVE APP MAIN DIR
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
#REMOVEME? ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
#REMOVEME? ynh_secure_remove --file="$install_dir"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..."
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
# Remove a directory securely
ynh_secure_remove --file="/etc/onlyoffice"
@ -90,17 +46,6 @@ ynh_secure_remove --file="/var/lib/onlyoffice"
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
#gpasswd -d www-data onlyoffice
#REMOVEME? ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -10,95 +8,35 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
#REMOVEME? jwt_secret=$(ynh_app_setting_get --app=$app --key=jwt_secret)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
#REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $install_dir "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb http://deb.debian.org/debian/ buster main contrib" --package="ttf-mscorefonts-installer" --key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..."
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
#REMOVEME? ynh_psql_test_if_first_run
#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
#=================================================
# CONFIGURE ONLYOFFICE
# INSTALL ONLYOFFICE
#=================================================
ynh_script_progression --message="Configuring OnlyOffice..."
ynh_script_progression --message="Install OnlyOffice..."
echo onlyoffice-documentserver onlyoffice/ds-port select $port | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/ds-port select "$port" | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-host string 127.0.0.1 | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-user string $db_user | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-pwd password $db_pwd | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-user string "$db_user" | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-pwd password "$db_pwd" | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-name string "$db_name" | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/jwt-secret password "$jwt_secret" | debconf-set-selections
#JWT options
#echo onlyoffice-documentserver onlyoffice/jwt-secret password $jwt_secret | debconf-set-selections
# The OnlyOffice dev had the magnificent idea to add a "nginx restart" during
# the install/configure of their package, which is awful since that will
# restart NGINX and the whole webadmin and maybe even the YunoHost command
# running the install...
#=================================================
# REINSTALL ONLYOFFICE
#=================================================
ynh_script_progression --message="Reinstalling OnlyOffice..."
#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://download.onlyoffice.com/repo/debian squeeze main" --package="onlyoffice-documentserver" --key="https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE"
# Can't do that in the manifest because we need the debconf-set-selections and postgresql already configured
ynh_exec_warn_less ynh_install_extra_app_dependencies \
--repo="https://download.onlyoffice.com/repo/debian squeeze main" \
--key="https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE" \
--package="onlyoffice-documentserver"
#=================================================
# RESTORE THE CONFIGURATION
@ -130,7 +68,12 @@ chmod -R o-rwx "$install_dir"
chown -R ds:ds "$install_dir"
#=================================================
# GENERIC FINALIZATION
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,114 +7,18 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
#REMOVEME? #jwt_secret=$(ynh_app_setting_get --app=$app --key=jwt_secret)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If install_dir doesn't exist, create it
if [ -z "$install_dir" ]; then
#REMOVEME? install_dir=/var/www/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
fi
if [ -z "$db_pwd" ]; then
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#REMOVEME? ynh_app_setting_set --app=$app --key=db_pwd
#REMOVEME? ynh_app_setting_set --app=$app --key=psqlpwd --value=$db_pwd
fi
# Cleaning legacy permissions
#REMOVEME? if ynh_legacy_permissions_exists; then
#REMOVEME? ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
ynh_secure_remove --file="/etc/apt/sources.list.d/onlyoffice.list"
ynh_secure_remove --file="/etc/apt/sources.list.d/nodesource.list"
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb http://deb.debian.org/debian/ $(lsb_release --codename --short) main contrib" --package="ttf-mscorefonts-installer" --key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
if [ "$path" = "/" ]; then
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="" --target_file="../conf/nginx.conf"
else
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="$path" --target_file="../conf/nginx.conf"
fi
# Create a dedicated nginx config
ynh_add_nginx_config "nextclouddomain"
#=================================================
# SPECIFIC UPGRADE
#=================================================
# CONFIGURE ONLYOFFICE
#=================================================
ynh_script_progression --message="Configuring OnlyOffice..."
ynh_script_progression --message="Upgrading OnlyOffice..."
ynh_backup_if_checksum_is_different --file="/etc/onlyoffice/documentserver/default.json"
echo onlyoffice-documentserver onlyoffice/ds-port select $port | debconf-set-selections
@ -124,22 +26,19 @@ echo onlyoffice-documentserver onlyoffice/db-host string 127.0.0.1 | debconf-set
echo onlyoffice-documentserver onlyoffice/db-user string $db_user | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-pwd password $db_pwd | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-selections
# JWT options
# echo onlyoffice-documentserver onlyoffice/jwt-secret password $jwt_secret | debconf-set-selections
#JWT options
#echo onlyoffice-documentserver onlyoffice/jwt-secret password $jwt_secret | debconf-set-selections
# The OnlyOffice dev had the magnificent idea to add a "nginx restart" during
# the install/configure of their package, which is awful since that will
# restart NGINX and the whole webadmin and maybe even the YunoHost command
# running the install...
#=================================================
# UPGRADE ONLYOFFICE
#=================================================
ynh_script_progression --message="Upgrading OnlyOffice..."
ynh_remove_extra_repo --name="$app" # backward compat
# keyserver.ubuntu.com response an error 500 regularly
# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
#REMOVEME? # ynh_remove_app_dependencies
#REMOVEME? ynh_install_extra_app_dependencies --repo="https://download.onlyoffice.com/repo/debian squeeze main" --package="onlyoffice-documentserver" --key="https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE"
# Can't do that in the manifest because we need the debconf-set-selections and postgresql already configured
ynh_exec_warn_less ynh_install_extra_app_dependencies \
--repo="https://download.onlyoffice.com/repo/debian squeeze main" \
--key="https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE" \
--package="onlyoffice-documentserver"
#=================================================
# UPDATE A CONFIG FILE
@ -148,7 +47,9 @@ ynh_script_progression --message="Updating a configuration file..."
ynh_backup_if_checksum_is_different --file="/etc/onlyoffice/documentserver/default.json"
ynh_replace_string --match_string="\"rejectUnauthorized\": true" --replace_string="\"rejectUnauthorized\": false" --target_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"
@ -170,22 +71,18 @@ chmod -R o-rwx "$install_dir"
chown -R ds:ds "$install_dir"
#=================================================
# GENERIC FINALIZATION
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
# START SYSTEMD SERVICE
#=================================================
# ynh_script_progression --message="Starting a systemd service..."
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# supervisorctl reload
if [ $path = "/" ]; then
path_no_slash=""
else
path_no_slash="$path"
fi
# sleep 30
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# END OF SCRIPT