pmaports/main/swclock-offset/swclock-offset-shutdown.initd
Jakob Hauser e6b0103b8c
main/swclock-offset: new package (MR 2191)
Some devices have a working but non-writable real-time clock (RTC).
This package contains two shell scripts: One writes the offset between
'hwclock' and 'swclock' to a file at shutdown, another one reads the
offset from the file at boot and sets the 'swclock'. This way the system
time in userspace is kept in present time.

[ci:skip-build] already built successfully in CI
2021-06-08 19:45:11 -07:00

29 lines
672 B
Text

#!/sbin/openrc-run
# A dedicated shutdown service is used to write the offset file instead
# of using the stop function of the swclock-offset service at boot. This
# approach is more fail-safe on different installation/deinstallation
# situations.
#
# Because the shutdown services are performed late within the shutdown
# runlevel, dependencies are needed to execute the script before
# processes are killed and filesystems are remounted read-only.
description="Writing the offset between system time and RTC to a file."
depend()
{
before killprocs mount-ro
}
start()
{
ebegin "Saving swclock-offset"
/sbin/swclock-offset-shutdown
eend $?
}
stop()
{
return 0
}