mirror of
https://github.com/YunoHost-Apps/onlyoffice_ynh.git
synced 2024-09-03 19:56:11 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
8b13d8ce71
commit
4f3bc035f1
8 changed files with 79 additions and 94 deletions
|
@ -19,7 +19,8 @@ code = "https://github.com/ONLYOFFICE/DocumentServer"
|
|||
cpe = "cpe:2.3:a:onlyoffice:document_server"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
yunohost = ">= 11.2.18"
|
||||
helpers_version = "2.1"
|
||||
architectures = ["amd64", "arm64"]
|
||||
multi_instance = false
|
||||
ldap = "not_relevant"
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||
#=================================================
|
||||
|
||||
_install_msfonts_deb() {
|
||||
|
||||
|
||||
# Do not replace app dependencies
|
||||
YNH_INSTALL_APP_DEPENDENCIES_REPLACE="false"
|
||||
|
||||
# Run this here because it's less verbose for some reason
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies \
|
||||
ynh_hide_warnings ynh_apt_install_dependencies_from_extra_repository \
|
||||
--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"
|
||||
--package="ttf-mscorefonts-installer"
|
||||
|
||||
}
|
||||
|
||||
_install_onlyoffice_deb() {
|
||||
|
@ -32,15 +29,7 @@ _install_onlyoffice_deb() {
|
|||
# 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...
|
||||
|
||||
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
ynh_package_install $install_dir/onlyoffice-documentserver.deb
|
||||
_ynh_apt_install $install_dir/onlyoffice-documentserver.deb
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -8,31 +8,28 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
ynh_print_info "Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup "/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
|
||||
ynh_backup "/etc/onlyoffice"
|
||||
ynh_backup "/var/lib/onlyoffice/documentserver/App_Data/cache/files" || true
|
||||
|
||||
ynh_backup --src_path="/var/log/$app/"
|
||||
ynh_backup "/var/log/$app/"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||
ynh_print_info "Backing up the PostgreSQL database..."
|
||||
|
||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||
ynh_psql_dump_db > db.sql
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -10,12 +10,12 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||
ynh_script_progression "Updating NGINX web server configuration..."
|
||||
|
||||
ynh_change_url_nginx_config
|
||||
ynh_config_change_url_nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app"
|
||||
ynh_script_progression "Change of URL completed for $app"
|
||||
|
|
|
@ -14,12 +14,12 @@ source /usr/share/yunohost/helpers
|
|||
admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
|
||||
|
||||
jwt_secret=$(ynh_string_random --length=32)
|
||||
ynh_app_setting_set --app="$app" --key=jwt_secret --value="$jwt_secret"
|
||||
ynh_app_setting_set --key=jwt_secret --value="$jwt_secret"
|
||||
|
||||
#=================================================
|
||||
# INSTALL ONLYOFFICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Install OnlyOffice..."
|
||||
ynh_script_progression "Install OnlyOffice..."
|
||||
|
||||
_install_msfonts_deb
|
||||
_install_onlyoffice_deb
|
||||
|
@ -27,17 +27,18 @@ _install_onlyoffice_deb
|
|||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding $app's configuration file..."
|
||||
ynh_script_progression "Adding $app's configuration file..."
|
||||
|
||||
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"
|
||||
ynh_replace --file="/etc/onlyoffice/documentserver/default.json" \
|
||||
--match="\"rejectUnauthorized\": true" \
|
||||
--replace="\"rejectUnauthorized\": false"
|
||||
|
||||
ynh_store_file_checksum "/etc/onlyoffice/documentserver/default.json"
|
||||
|
||||
#=================================================
|
||||
# REGENERATE FONTS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Generating fonts..."
|
||||
ynh_script_progression "Generating fonts..."
|
||||
|
||||
/usr/bin/documentserver-generate-allfonts.sh 2>/dev/null
|
||||
|
||||
|
@ -46,10 +47,9 @@ ynh_script_progression --message="Generating fonts..."
|
|||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R ds:ds "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R ds:ds "$install_dir"
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
@ -63,19 +63,19 @@ done
|
|||
#=================================================
|
||||
|
||||
for service in "ds-converter" "ds-docservice" "ds-metrics"; do
|
||||
ynh_systemd_action --action=restart --service_name="$service"
|
||||
ynh_systemctl --action=restart --service="$service"
|
||||
done
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
ynh_script_progression "Configuring NGINX web server..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed"
|
||||
ynh_script_progression "Installation of $app completed"
|
||||
|
|
|
@ -21,9 +21,9 @@ done
|
|||
#=================================================
|
||||
# REMOVE ONLYOFFICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing OnlyOffice..."
|
||||
ynh_script_progression "Removing OnlyOffice..."
|
||||
|
||||
ynh_secure_remove --file=/var/lib/dpkg/info/onlyoffice-documentserver.prerm
|
||||
ynh_safe_rm /var/lib/dpkg/info/onlyoffice-documentserver.prerm
|
||||
|
||||
# Here you will wonder what the fuck this is, and the answer is : this is a
|
||||
# fucking stupid hack because onlyoffice's dev deviced to put a "supervisorctl
|
||||
|
@ -32,28 +32,28 @@ ynh_secure_remove --file=/var/lib/dpkg/info/onlyoffice-documentserver.prerm
|
|||
# So instead, we trick it with this stupid link to /bin/true which is removed
|
||||
# right after.
|
||||
#ln -s /bin/true /usr/local/bin/supervisorctl
|
||||
ynh_package_autopurge onlyoffice-documentserver
|
||||
_ynh_apt autoremove --purge onlyoffice-documentserver
|
||||
|
||||
dpkg --configure -a
|
||||
|
||||
#=================================================
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Removing system configurations related to $app..."
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
ynh_config_remove_nginx
|
||||
|
||||
#=================================================
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
# Remove a directory securely
|
||||
ynh_secure_remove --file="/etc/onlyoffice"
|
||||
ynh_secure_remove --file="/var/lib/onlyoffice"
|
||||
ynh_safe_rm "/etc/onlyoffice"
|
||||
ynh_safe_rm "/var/lib/onlyoffice"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed"
|
||||
ynh_script_progression "Removal of $app completed"
|
||||
|
|
|
@ -11,14 +11,14 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
||||
ynh_script_progression "Restoring the PostgreSQL database..."
|
||||
|
||||
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
|
||||
ynh_psql_db_shell < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# INSTALL ONLYOFFICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Install OnlyOffice..."
|
||||
ynh_script_progression "Install OnlyOffice..."
|
||||
|
||||
_install_msfonts_deb
|
||||
_install_onlyoffice_deb
|
||||
|
@ -26,20 +26,20 @@ _install_onlyoffice_deb
|
|||
#=================================================
|
||||
# RESTORE THE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the configuration..."
|
||||
ynh_script_progression "Restoring the configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/onlyoffice"
|
||||
ynh_restore "/etc/onlyoffice"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE CACHE
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/var/lib/onlyoffice/documentserver/App_Data/cache/files"
|
||||
ynh_restore "/var/lib/onlyoffice/documentserver/App_Data/cache/files"
|
||||
|
||||
#=================================================
|
||||
# REGENERATE FONTS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Generating fonts..."
|
||||
ynh_script_progression "Generating fonts..."
|
||||
|
||||
/usr/bin/documentserver-generate-allfonts.sh 2>/dev/null
|
||||
|
||||
|
@ -48,16 +48,15 @@ ynh_script_progression --message="Generating fonts..."
|
|||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R ds:ds "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R ds:ds "$install_dir"
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Restoring system configurations related to $app..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
|
@ -72,18 +71,18 @@ done
|
|||
#=================================================
|
||||
|
||||
for service in "ds-converter" "ds-docservice" "ds-metrics"; do
|
||||
ynh_systemd_action --action=restart --service_name="$service"
|
||||
ynh_systemctl --action=restart --service="$service"
|
||||
done
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression "Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemctl --service=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app"
|
||||
ynh_script_progression "Restoration completed for $app"
|
||||
|
|
|
@ -10,17 +10,17 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
ynh_script_progression "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"
|
||||
ynh_safe_rm "/etc/apt/sources.list.d/onlyoffice.list"
|
||||
ynh_safe_rm "/etc/apt/sources.list.d/nodesource.list"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE ONLYOFFICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading OnlyOffice..."
|
||||
ynh_script_progression "Upgrading OnlyOffice..."
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="/etc/onlyoffice/documentserver/default.json"
|
||||
ynh_backup_if_checksum_is_different "/etc/onlyoffice/documentserver/default.json"
|
||||
|
||||
_install_msfonts_deb
|
||||
_install_onlyoffice_deb
|
||||
|
@ -28,21 +28,21 @@ _install_onlyoffice_deb
|
|||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
ynh_script_progression "Updating configuration..."
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="/etc/onlyoffice/documentserver/default.json"
|
||||
ynh_backup_if_checksum_is_different "/etc/onlyoffice/documentserver/default.json"
|
||||
|
||||
ynh_replace_string --target_file="/etc/onlyoffice/documentserver/default.json" \
|
||||
--match_string="\"rejectUnauthorized\": true" \
|
||||
--replace_string="\"rejectUnauthorized\": false"
|
||||
ynh_replace --file="/etc/onlyoffice/documentserver/default.json" \
|
||||
--match="\"rejectUnauthorized\": true" \
|
||||
--replace="\"rejectUnauthorized\": false"
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="/etc/onlyoffice/documentserver/default.json"
|
||||
ynh_store_file_checksum "/etc/onlyoffice/documentserver/default.json"
|
||||
|
||||
#=================================================
|
||||
# REGENERATE FONTS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Generating fonts..."
|
||||
ynh_script_progression "Generating fonts..."
|
||||
|
||||
/usr/bin/documentserver-generate-allfonts.sh 2>/dev/null
|
||||
|
||||
|
@ -51,10 +51,9 @@ ynh_script_progression --message="Generating fonts..."
|
|||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R ds:ds "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R ds:ds "$install_dir"
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
@ -68,19 +67,19 @@ done
|
|||
#=================================================
|
||||
|
||||
for service in "ds-converter" "ds-docservice" "ds-metrics"; do
|
||||
ynh_systemd_action --action=restart --service_name="$service"
|
||||
ynh_systemctl --action=restart --service="$service"
|
||||
done
|
||||
|
||||
#=================================================
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed"
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue