1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/collabora_ynh.git synced 2024-09-03 18:16:25 +02:00

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-30 22:44:57 +02:00 committed by Alexandre Aubin
parent 1a34d35a52
commit 3cdca5acc3
8 changed files with 57 additions and 110 deletions

BIN
doc/.DS_Store vendored

Binary file not shown.

View file

@ -18,7 +18,8 @@ admindoc = "https://www.collaboraoffice.com/code/"
cpe = "cpe:2.3:a:collabora:online" cpe = "cpe:2.3:a:collabora:online"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = ["amd64", "i386", "arm64"] architectures = ["amd64", "i386", "arm64"]
multi_instance = false multi_instance = false
ldap = "not_relevant" ldap = "not_relevant"
@ -51,6 +52,7 @@ ram.runtime = "600M"
[resources.system_user] [resources.system_user]
[resources.install_dir] [resources.install_dir]
group = "www-data:r-x"
[resources.permissions] [resources.permissions]
main.url = "/" main.url = "/"

View file

@ -1,17 +1,5 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#================================================= #=================================================

View file

@ -1,40 +1,31 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_print_info "Declaring files to be backed up..."
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # 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 # BACKUP VARIOUS FILES
#================================================= #=================================================
ynh_backup --src_path="/etc/coolwsd/coolwsd.xml" ynh_backup "/etc/coolwsd/coolwsd.xml"
#================================================= #=================================================
# END OF SCRIPT # 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)."

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -13,28 +7,27 @@ source /usr/share/yunohost/helpers
# INITIALIZE AND STORE SETTINGS # 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 # 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" ynh_config_add --template="root_index.html" --destination="$install_dir/index.html"
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"
#================================================= #=================================================
# CONFIGURE ONLYOFFICE # 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, # 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 # 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 # config directory which of course doesn't exists and we want to disable SSL
# because we're in a reverse proxy context... # because we're in a reverse proxy context...
mkdir -p /etc/coolwsd 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" chmod 640 "/etc/coolwsd/coolwsd.xml"
chown cool:root -R /etc/coolwsd chown cool:root -R /etc/coolwsd
@ -42,30 +35,28 @@ chown cool:root -R /etc/coolwsd
#================================================= #=================================================
# SYSTEM CONFIGURATION # 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 # 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" yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# START SYSTEMD SERVICE # 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 ... # 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. # The service installed by the deb package failed in loop, thus the reset-failed.
systemctl reset-failed coolwsd systemctl reset-failed coolwsd
# Start a systemd service # 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 # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression "Installation of $app completed"

View file

@ -1,33 +1,26 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# REMOVE SYSTEM CONFIGURATIONS # 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`) # 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" yunohost service remove "coolwsd"
fi fi
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config --service="coolwsd" ynh_config_remove_systemd"coolwsd"
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_config_remove_nginx
# Remove a directory securely # Remove a directory securely
ynh_secure_remove --file="/etc/coolwsd" ynh_safe_rm "/etc/coolwsd"
# FIXME: is it still required? # FIXME: is it still required?
# Fix "rm: cannot remove '/etc/apt/apt.conf.d/25loolwsd': No such file or directory" # 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 # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression "Removal of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -13,21 +7,20 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # 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 ### $install_dir will automatically be initialized with some decent
### permissions by default ... however, you may need to recursively reapply ### permissions by default ... however, you may need to recursively reapply
### ownership to all files such as after the ynh_setup_source step ### 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 # 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" chmod 640 "/etc/coolwsd/coolwsd.xml"
chown cool:root -R /etc/coolwsd chown cool:root -R /etc/coolwsd
@ -35,31 +28,29 @@ chown cool:root -R /etc/coolwsd
#================================================= #=================================================
# RESTORE SYSTEM CONFIGURATIONS # 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" yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# START SYSTEMD SERVICE # 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 ... # 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. # The service installed by the deb package failed in loop, thus the reset-failed.
systemctl reset-failed coolwsd systemctl reset-failed coolwsd
# Start a systemd service # 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 # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression "Restoration completed for $app"

View file

@ -1,21 +1,15 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # 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 if ynh_app_upgrading_from_version_before_or_equal_to 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" ynh_die "Upgrade from version 6.4.10 is not possible. You must uninstall and reinstall Collabora package manually"
fi fi
#================================================= #=================================================
@ -23,38 +17,35 @@ fi
#================================================= #=================================================
# Remove the old service from the list of services known by YunoHost (added from `yunohost service add`) # 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 if ynh_hide_warnings yunohost service status "loolwsd" >/dev/null; then
ynh_script_progression --message="Removing loolwsd service integration..." --weight=1 ynh_script_progression "Removing loolwsd service integration..."
yunohost service remove "loolwsd" yunohost service remove "loolwsd"
fi fi
# Remove the legacy systemd config # Remove the legacy systemd config
ynh_remove_systemd_config --service="loolwsd" ynh_config_remove_systemd"loolwsd"
#=================================================
# STANDARD UPGRADE STEPS
#================================================= #=================================================
# STOP SYSTEMD SERVICE # 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 # 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" ynh_config_add --template="root_index.html" --destination="$install_dir/index.html"
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"
#================================================= #=================================================
# UPGRADE CONFIG # 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" chown cool: "/etc/coolwsd/coolwsd.xml"
chmod 640 "/etc/coolwsd/coolwsd.xml" chmod 640 "/etc/coolwsd/coolwsd.xml"
@ -62,22 +53,22 @@ chmod 640 "/etc/coolwsd/coolwsd.xml"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # 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 # 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" yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # 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 # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression "Upgrade of $app completed"