[Main]
Type = oneshot
Version = 0.1.1
Description = "hwclock oneshot"
User = ( root )
Depends = ( devmanager mount-procfs )
# Do NOT OptsDepends on fake-hwclock: 66 folds OptsDepends into hard Depends,
# so removing fake-hwclock would also drop this oneshot. Ordering is already
# guaranteed when fake-hwclock is present (tree seed requiredby=misc-essential).
Options = ( !log )

[Start]
Execute = (
	envfile /etc/s6-rc/config/hwclock.conf
	importas -uD "UTC" HARDWARECLOCK HARDWARECLOCK
	
	ifelse { test $HARDWARECLOCK = UTC } { hwclock --systz --utc --noadjfile } hwclock --systz --localtime --noadjfile
)

[Stop]
Execute = (
	envfile /etc/s6-rc/config/hwclock.conf
	importas -uD "UTC" HARDWARECLOCK HARDWARECLOCK
	
	ifelse { test $HARDWARECLOCK = UTC } { hwclock --systz --utc --noadjfile } hwclock --systz --localtime --noadjfile
)
