@echo off
rem -- Check if argument is INSTALL or REMOVE

if not ""%1"" == ""INSTALL"" goto remove

"@@BITROCK_LO_ROOTDIR@@\scripts\winserv.exe" install @@BITROCK_LO_SERVICE_NAME@@ -displayname "@@BITROCK_LO_SERVICE_NAME@@" -start auto "@@BITROCK_LO_ROOTDIR@@\App\libreoffice\program\soffice.exe" --nofirststartwizard --nologo --headless --accept=socket,host=127.0.0.1,port=@@BITROCK_LO_PORT@@;urp;

if ""%2"" == ""STOP"" goto end
net start @@BITROCK_LO_SERVICE_NAME@@ >NUL
goto end

:remove
rem -- STOP SERVICES BEFORE REMOVING

net stop @@BITROCK_LO_SERVICE_NAME@@ >NUL
"@@BITROCK_LO_ROOTDIR@@\scripts\winserv.exe" uninstall @@BITROCK_LO_SERVICE_NAME@@

:end
exit
