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

60 lines
2.3 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INITIALIZE AND STORE SETTINGS
#=================================================
ynh_app_setting_set --app="$app" --key=password --value="$password"
#=================================================
# CONFIGURE ONLYOFFICE
#=================================================
ynh_script_progression --message="Installing config file..." --weight=2
# 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="../conf/coolwsd.xml" --destination="/etc/coolwsd/coolwsd.xml"
chmod 640 "/etc/coolwsd/coolwsd.xml"
chown cool:root -R /etc/coolwsd
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log"
ynh_exec_warn systemctl cat coolwsd
#=================================================
# GENERIC FINALIZATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=5
# Start a 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="restart" --log_path="systemd" --line_match="Ready to accept connections"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last