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

move code to _common.sh

This commit is contained in:
Félix Piédallu 2024-03-19 14:57:06 +01:00
parent 7376702a3a
commit 36f5e3e94c
5 changed files with 41 additions and 57 deletions

View file

@ -74,10 +74,11 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
"libcurl4-openssl-dev",
]
[resources.apt.extras.ttf]
repo = "deb http://deb.debian.org/debian/ bullseye main contrib"
key = "https://ftp-master.debian.org/keys/release-bullseye.asc"
packages = ["ttf-mscorefonts-installer"]
# Manual install in scripts
# [resources.apt.extras.ttf]
# repo = "deb http://deb.debian.org/debian/ bullseye main contrib"
# key = "https://ftp-master.debian.org/keys/release-bullseye.asc"
# packages = ["ttf-mscorefonts-installer"]
# Manual install in scripts
# [resources.apt.extras.onlyoffice]

View file

@ -8,6 +8,34 @@
# PERSONAL HELPERS
#=================================================
_install_msfonts_deb() {
# Run this here because it's less verbose for some reason
ynh_exec_warn_less ynh_install_extra_app_dependencies \
--repo="deb http://deb.debian.org/debian/ $(lsb_release --codename --short) main contrib" \
--key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc" \
--package="ttf-mscorefonts-installer"
}
_install_onlyoffice_deb() {
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/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...
# 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"
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -21,23 +21,8 @@ ynh_app_setting_set --app="$app" --key=jwt_secret --value="$jwt_secret"
#=================================================
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
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
# 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...
# 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"
_install_msfonts_deb
_install_onlyoffice_deb
#=================================================
# ADD A CONFIGURATION

View file

@ -20,23 +20,8 @@ ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name"
#=================================================
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
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
# 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...
# 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"
_install_msfonts_deb
_install_onlyoffice_deb
#=================================================
# RESTORE THE CONFIGURATION

View file

@ -21,24 +21,9 @@ ynh_secure_remove --file="/etc/apt/sources.list.d/nodesource.list"
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
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
# 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...
# 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"
_install_msfonts_deb
_install_onlyoffice_deb
#=================================================
# UPDATE A CONFIG FILE
@ -48,8 +33,8 @@ 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"
--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"