diff --git a/init.d/swclock.in b/init.d/swclock.in index 2d7187ba2..08b1d2c7c 100644 --- a/init.d/swclock.in +++ b/init.d/swclock.in @@ -15,6 +15,7 @@ swclock_file="${swclock_file:-/var/lib/misc/openrc-shutdowntime}" depend() { provide clock + use bootmisc keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu -wsl } @@ -22,9 +23,12 @@ depend() start() { + local fallback_file="@SBINDIR@/openrc-run" + ebegin "Setting the local clock based on last shutdown time" if ! swclock "${swclock_file}" 2> /dev/null; then - swclock --warn @SBINDIR@/openrc-run + swclock --warn "${fallback_file}" + ewarn "Falling back to ${fallback_file} as clock reference" fi eend $? } @@ -32,6 +36,7 @@ start() stop() { ebegin "Saving the shutdown time" + checkpath -f -W -o root:root -m 0644 "${swclock_file}" swclock --save "${swclock_file}" eend $? }