[Main]
Type = classic
Version = 0.1.0
Description = "preload daemon"
User = ( root )
Depends = ( mount-rw )
Options = ( log )

[Start]
Execute = (
	# preload in foreground (-f), matching debian/sv/preload.
	# -l '' sends logging to the s6 pipeline instead of a file.
	# OPTIONS / DAEMON_OPTS from /etc/default/preload (OpenRC).
	
	envfile -I /etc/default/preload
	importas -sCuD "" DAEMON_OPTS DAEMON_OPTS
	importas -sCuD "" OPTIONS OPTIONS
	
	foreground { mkdir -p /var/lib/preload }
	
	exec /usr/sbin/preload ${Args} ${DAEMON_OPTS} ${OPTIONS}
)

[Logger]
RunAs = s6log
Backup = 3
MaxSize = 2000000
Timestamp = tai
Destination = /var/log/preload-s6

[Environment]
Args = !-s /var/lib/preload/preload.state -f -l ''
