diff --git a/scripts/backup b/scripts/backup index 5591094..f3d024e 100644 --- a/scripts/backup +++ b/scripts/backup @@ -40,6 +40,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# BACKUP SYSTEMD +#================================================= + +ynh_backup --src_path="/usr/lib/systemd/system/loolwsd.service" + #================================================= # SPECIFIC BACKUP #================================================= diff --git a/scripts/install b/scripts/install index 3b7860e..8b0d851 100644 --- a/scripts/install +++ b/scripts/install @@ -91,6 +91,13 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=3 # Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +yunohost service add $app --description="Collabora online office suite" --log="/var/log/$app/$app.log" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/remove b/scripts/remove index f6739f2..da00d34 100644 --- a/scripts/remove +++ b/scripts/remove @@ -19,6 +19,25 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) port=$(ynh_app_setting_get --app=$app --key=port) +#================================================= +# REMOVE SERVICE INTEGRATION IN YUNOHOST +#================================================= + +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) +if ynh_exec_warn_less yunohost service status $app >/dev/null +then + ynh_script_progression --message="Removing $app service integration..." --weight=1 + yunohost service remove $app +fi + +#================================================= +# STOP AND REMOVE SERVICE +#================================================= +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 + +# Remove the dedicated systemd config +ynh_remove_systemd_config --service="loolwsd" + #================================================= # STANDARD REMOVE #================================================= diff --git a/scripts/restore b/scripts/restore index fd8b94a..122a026 100644 --- a/scripts/restore +++ b/scripts/restore @@ -56,6 +56,14 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=10 DEBIAN_VERSION_NUMBER=$(cat /etc/debian_version | head -n 1 | cut -f1 -d .) ynh_install_extra_app_dependencies --repo="deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian${DEBIAN_VERSION_NUMBER} ./ " --package="$pkg_dependencies" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0C54D189F4BA284D" +#================================================= +# RESTORE SYSTEMD +#================================================= +ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 + +ynh_restore_file --origin_path="/usr/lib/systemd/system/loolwsd.service" +systemctl enable $app.service --quiet + #================================================= # RESTORE CONFIGURATION #================================================= @@ -63,6 +71,13 @@ ynh_script_progression --message="Restoring the configuration..." --weight=3 ynh_restore_file --origin_path="/etc/loolwsd/loolwsd.xml" +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +yunohost service add $app --description="Collabora online office suite" --log="/var/log/$app/$app.log" + #================================================= # START SYSTEMD SERVICE #================================================= @@ -70,8 +85,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name="loolwsd" --action="restart" --log_path="systemd" --line_match="Ready to accept connections" -#================================================= -# GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 5333c6d..a4614db 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -88,7 +88,12 @@ ynh_install_extra_app_dependencies --repo="deb https://collaboraoffice.com/repos ynh_add_config --template="../conf/loolwsd.xml" --destination="/etc/loolwsd/loolwsd.xml" #================================================= -# GENERIC FINALIZATION +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +yunohost service add $app --description="Collabora online office suite" --log="/var/log/$app/$app.log" + #================================================= # START SYSTEMD SERVICE #=================================================