From 3cdca5acc3adfd6237d9e9903bf928c0025307ed Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Fri, 30 Aug 2024 22:44:57 +0200 Subject: [PATCH] [autopatch] Automatic patch attempt for helpers 2.1 --- doc/.DS_Store | Bin 6148 -> 0 bytes manifest.toml | 4 +++- scripts/_common.sh | 14 +------------- scripts/backup | 19 +++++-------------- scripts/install | 33 ++++++++++++--------------------- scripts/remove | 19 ++++++------------- scripts/restore | 33 ++++++++++++--------------------- scripts/upgrade | 45 ++++++++++++++++++--------------------------- 8 files changed, 57 insertions(+), 110 deletions(-) delete mode 100644 doc/.DS_Store diff --git a/doc/.DS_Store b/doc/.DS_Store deleted file mode 100644 index c90376b56b73b627c519d1a34c5d8c9abb7004dc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKyG{c^3>-s>NNG}1?l15Mt0;UyegFv&DbPhqfch%Fi%(bFB<-Yt6!=#P*lfL7ulP#UTPH8)y|&RG>0a|qcjG!J4AG8> j(T=(Cc6=8_S=W5c^IkY62A%n!6ZJFTy2zx!wH5dQ#>Eyj diff --git a/manifest.toml b/manifest.toml index 13f7609..02f224d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -18,7 +18,8 @@ admindoc = "https://www.collaboraoffice.com/code/" cpe = "cpe:2.3:a:collabora:online" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = ["amd64", "i386", "arm64"] multi_instance = false ldap = "not_relevant" @@ -51,6 +52,7 @@ ram.runtime = "600M" [resources.system_user] [resources.install_dir] + group = "www-data:r-x" [resources.permissions] main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..3d7f008 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,17 +1,5 @@ #!/bin/bash #================================================= -# COMMON VARIABLES -#================================================= - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 59b1d7d..9abe4f9 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,40 +1,31 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts 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..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="/etc/coolwsd/coolwsd.xml" +ynh_backup "/etc/coolwsd/coolwsd.xml" #================================================= # 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)." diff --git a/scripts/install b/scripts/install index 4a2ac59..24af8d3 100644 --- a/scripts/install +++ b/scripts/install @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -13,28 +7,27 @@ source /usr/share/yunohost/helpers # INITIALIZE AND STORE SETTINGS #================================================= -ynh_app_setting_set --app="$app" --key=password --value="$password" +ynh_app_setting_set --key=password --value="$password" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression "Setting up source files..." -ynh_add_config --template="root_index.html" --destination="$install_dir/index.html" - -chown -R "$app:www-data" "$install_dir" +ynh_config_add --template="root_index.html" --destination="$install_dir/index.html" +#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 "$app:www-data" "$install_dir" #================================================= # CONFIGURE ONLYOFFICE #================================================= -ynh_script_progression --message="Installing config file..." --weight=2 +ynh_script_progression "Installing config file..." # Turns out we need to create/copy this file BEFORE the actual .deb install, # otherwise stupid collabora will expect to find a certificate file in its own # config directory which of course doesn't exists and we want to disable SSL # because we're in a reverse proxy context... mkdir -p /etc/coolwsd -ynh_add_config --template="coolwsd.xml" --destination="/etc/coolwsd/coolwsd.xml" +ynh_config_add --template="coolwsd.xml" --destination="/etc/coolwsd/coolwsd.xml" chmod 640 "/etc/coolwsd/coolwsd.xml" chown cool:root -R /etc/coolwsd @@ -42,30 +35,28 @@ chown cool:root -R /etc/coolwsd #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 +ynh_script_progression "Adding system configurations related to $app..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log" -#================================================= -# GENERIC FINALIZATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=5 +ynh_script_progression "Starting $app's systemd service..." # NB. : we need a stupid *re*start because the service is in fact already started during the damn package install ... so it won't find a recent "Ready to accept connection" match ... -ynh_systemd_action --service_name="coolwsd" --action="stop" --log_path="systemd" +ynh_systemctl --service="coolwsd" --action="stop" --log_path="systemd" # The service installed by the deb package failed in loop, thus the reset-failed. systemctl reset-failed coolwsd # Start a systemd service -ynh_systemd_action --service_name="coolwsd" --action="start" --log_path="systemd" --line_match="Ready to accept connections" +ynh_systemctl --service="coolwsd" --action="start" --log_path="systemd" --wait_until="Ready to accept connections" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 777208f..c992ef2 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,33 +1,26 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # 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 service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status "coolwsd" >/dev/null; then +if ynh_hide_warnings yunohost service status "coolwsd" >/dev/null; then yunohost service remove "coolwsd" fi # Remove the dedicated systemd config -ynh_remove_systemd_config --service="coolwsd" +ynh_config_remove_systemd"coolwsd" # Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx # Remove a directory securely -ynh_secure_remove --file="/etc/coolwsd" - +ynh_safe_rm "/etc/coolwsd" # FIXME: is it still required? # Fix "rm: cannot remove '/etc/apt/apt.conf.d/25loolwsd': No such file or directory" @@ -38,4 +31,4 @@ touch /etc/apt/apt.conf.d/25loolwsd # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 8151baf..8a35942 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -13,21 +7,20 @@ source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" +ynh_restore "$install_dir" ### $install_dir will automatically be initialized with some decent ### permissions by default ... however, you may need to recursively reapply ### ownership to all files such as after the ynh_setup_source step -chown -R "$app:www-data" "$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 "$app:www-data" "$install_dir" #================================================= # RESTORE CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the configuration..." --weight=3 +ynh_script_progression "Restoring the configuration..." -ynh_restore_file --origin_path="/etc/coolwsd/coolwsd.xml" +ynh_restore "/etc/coolwsd/coolwsd.xml" chmod 640 "/etc/coolwsd/coolwsd.xml" chown cool:root -R /etc/coolwsd @@ -35,31 +28,29 @@ chown cool:root -R /etc/coolwsd #================================================= # 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" yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log" -#================================================= -# GENERIC FINALIZATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=5 +ynh_script_progression "Starting $app's systemd service..." # NB. : we need a stupid *re*start because the service is in fact already started during the damn package install ... so it won't find a recent "Ready to accept connection" match ... -ynh_systemd_action --service_name="coolwsd" --action="stop" --log_path="systemd" +ynh_systemctl --service="coolwsd" --action="stop" --log_path="systemd" # The service installed by the deb package failed in loop, thus the reset-failed. systemctl reset-failed coolwsd # Start a systemd service -ynh_systemd_action --service_name="coolwsd" --action="start" --log_path="systemd" --line_match="Ready to accept connections" +ynh_systemctl --service="coolwsd" --action="start" --log_path="systemd" --wait_until="Ready to accept connections" -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" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 7d34b90..029d1f8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,21 +1,15 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=2 +ynh_script_progression "Ensuring downward compatibility..." -if ynh_compare_current_package_version --comparison le --version 6.4.10~ynh2; then - ynh_die --message="Upgrade from version 6.4.10 is not possible. You must uninstall and reinstall Collabora package manually" +if ynh_app_upgrading_from_version_before_or_equal_to 6.4.10~ynh2; then + ynh_die "Upgrade from version 6.4.10 is not possible. You must uninstall and reinstall Collabora package manually" fi #================================================= @@ -23,38 +17,35 @@ fi #================================================= # Remove the old service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status "loolwsd" >/dev/null; then - ynh_script_progression --message="Removing loolwsd service integration..." --weight=1 +if ynh_hide_warnings yunohost service status "loolwsd" >/dev/null; then + ynh_script_progression "Removing loolwsd service integration..." yunohost service remove "loolwsd" fi # Remove the legacy systemd config -ynh_remove_systemd_config --service="loolwsd" +ynh_config_remove_systemd"loolwsd" -#================================================= -# STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=5 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name="coolwsd" --action="stop" --log_path="systemd" --line_match="Stopped Collabora Online WebSocket Daemon" +ynh_systemctl --service="coolwsd" --action="stop" --log_path="systemd" --wait_until="Stopped Collabora Online WebSocket Daemon" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression "Setting up source files..." -ynh_add_config --template="root_index.html" --destination="$install_dir/index.html" - -chown -R "$app:www-data" "$install_dir" +ynh_config_add --template="root_index.html" --destination="$install_dir/index.html" +#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 "$app:www-data" "$install_dir" #================================================= # UPGRADE CONFIG #================================================= -ynh_script_progression --message="Upgrading config file..." --weight=2 +ynh_script_progression "Upgrading config file..." -ynh_add_config --template="../conf/coolwsd.xml" --destination="/etc/coolwsd/coolwsd.xml" +ynh_config_add --template="coolwsd.xml" --destination="/etc/coolwsd/coolwsd.xml" chown cool: "/etc/coolwsd/coolwsd.xml" chmod 640 "/etc/coolwsd/coolwsd.xml" @@ -62,22 +53,22 @@ chmod 640 "/etc/coolwsd/coolwsd.xml" #================================================= # 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 yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=3 +ynh_script_progression "Starting $app's systemd service..." -ynh_systemd_action --service_name="coolwsd" --action="restart" --log_path="systemd" --line_match="Ready to accept connections" +ynh_systemctl --service="coolwsd" --action="restart" --log_path="systemd" --wait_until="Ready to accept connections" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"