###############################################################################
#
# Open iT Patch definition
#
# Create a sequence (top down) of instructions for how to install the patch
# Please refer to the following wiki page for more information:
#
#    https://wiki.openit.com/bin/view/Development/NewOpeniTPatchSystem
#


# The following is an example. Be sure to clear (or completely replace it) when
# you make a new patch!

# Stop service
stop
{
	error=warning
	module=service
}

# Stop sentinel processes
stop
{
	error=warning
	module=sentinelprocesses
}

# Wait for all previously signalled programs to stop
waitstop
{
	error=fatal
	timeout=60
	kill=no
}

# Install binaries
install
{
	error=fatal
	source=bin/openit_scheduler.exe
	target=%installdir%/bin/openit_scheduler.exe
}

install
{
	error=fatal
	source=bin/openit_usint.exe
	target=%installdir%/bin/openit_usint.exe
}

install
{
	error=fatal
	condition=openitversion > 6020007
	source=bin/openit_usageanalyzer.exe
	target=%installdir%/bin/openit_usageanalyzer.exe
}

install
{
	error=fatal
	condition=openitversion < 6020011
	source=bin/openit_usageanalyzer.exe
	target=%installdir%/bin/recorder.exe
}


# ProgramLauncher configuration update
backup
{
	error=fatal
	source=%confdir%/Components/programlauncher.xml
}

backup
{
	error=fatal
	source=%confdir%/Components/jobs.xml
}

backup
{
	error=fatal
	source=%confdir%/Components/sentinel.xml
}

confset
{
	error=fatal
	target=%confdir%/Components/jobs.xml
	path=DCML.jobs.ProgramLauncher.active
	value=true
}

confremove
{
	error=warning
	target=%confdir%/Components/sentinel.xml
	path=DCML.sentinel.monitor.Recorder
}

confset
{
	error=fatal
	condition=openitversion >= 6030005
	target=%confdir%/Components/sentinel.xml
	path=DCML.sentinel.monitor.Usint.active
	value=false
}

confset
{
	error=fatal
	target=%confdir%/Components/programlauncher.xml
	path=DCML.ProgramLauncher.processes.process-sentinel
	value=openit_sentinel.exe
}

confcopy
{
	error=fatal
	condition=openitversion < 6030005
	source=conf/programlauncher.xml
	target=%confdir%/Components/programlauncher.xml
	source-path=DCML.ProgramLauncher.processes.process-usint
	target-path=DCML.ProgramLauncher.processes
	replace=true
}

confcopy
{
	error=fatal
	condition=openitversion < 6030005
	source=conf/programlauncher.xml
	target=%confdir%/Components/programlauncher.xml
	source-path=DCML.ProgramLauncher.processes.process-usageanalyzer
	target-path=DCML.ProgramLauncher.processes
	replace=true
}

# Start service
start
{
	error=warning
	module=service
}

# Start sentinel processes again
start
{
	error=warning
	module=sentinelprocesses
}