2017-06-21 11:34:24 +02:00
#!/bin/bash
2018-11-02 18:15:03 +01:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
2024-01-29 11:36:53 +01:00
# INITIALIZE AND STORE SETTINGS
2018-11-02 18:15:03 +01:00
#=================================================
2024-01-29 11:36:53 +01:00
ynh_app_setting_set --app="$app" --key=password --value="$password"
2017-06-21 11:34:24 +02:00
2021-01-09 23:59:37 +01:00
#=================================================
# CONFIGURE ONLYOFFICE
#=================================================
2021-08-06 10:09:07 +02:00
ynh_script_progression --message="Installing config file..." --weight=2
2021-01-09 23:59:37 +01:00
# 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...
2021-12-21 09:19:35 +01:00
mkdir -p /etc/coolwsd
2024-01-29 14:32:20 +01:00
ynh_add_config --template="coolwsd.xml" --destination="/etc/coolwsd/coolwsd.xml"
2024-01-29 13:48:39 +01:00
2021-12-21 09:19:35 +01:00
chmod 640 "/etc/coolwsd/coolwsd.xml"
2024-01-29 13:48:39 +01:00
chown cool:root -R /etc/coolwsd
2021-01-09 23:59:37 +01:00
2019-08-04 23:00:10 +02:00
#=================================================
2024-01-29 11:36:53 +01:00
# SYSTEM CONFIGURATION
2019-08-04 23:00:10 +02:00
#=================================================
2024-01-29 11:36:53 +01:00
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
2017-06-25 09:05:13 +02:00
2020-09-22 16:57:16 +02:00
# Create a dedicated NGINX config
2017-08-22 19:27:56 +02:00
ynh_add_nginx_config
2017-06-25 09:05:13 +02:00
2021-12-21 09:19:35 +01:00
yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log"
2021-06-26 09:23:07 +02:00
2018-11-02 18:15:03 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
2019-08-04 23:00:10 +02:00
# START SYSTEMD SERVICE
2018-11-02 18:15:03 +01:00
#=================================================
2021-06-26 08:19:34 +02:00
ynh_script_progression --message="Starting a systemd service..." --weight=5
2018-11-02 18:15:03 +01:00
2021-01-09 23:59:37 +01:00
# 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 ...
2024-01-29 14:05:39 +01:00
ynh_systemd_action --service_name="coolwsd" --action="stop" --log_path="systemd"
2024-01-29 14:32:20 +01:00
# The service installed by the deb package failed in loop, thus the reset-failed.
2024-01-29 14:05:51 +01:00
systemctl reset-failed coolwsd
2024-01-29 14:32:20 +01:00
# Start a systemd service
2024-01-29 14:05:39 +01:00
ynh_systemd_action --service_name="coolwsd" --action="start" --log_path="systemd" --line_match="Ready to accept connections"
2018-11-02 18:15:03 +01:00
2019-08-04 23:00:10 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2017-08-22 19:27:56 +02:00
2021-06-26 08:19:34 +02:00
ynh_script_progression --message="Installation of $app completed" --last