From 839083bb523b82cca28d3f0ecc8d4c3469a0853d Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Thu, 8 Dec 2022 09:56:40 -0600 Subject: [PATCH] make the location of the swclock reference file configurable This fixes #565. --- conf.d/meson.build | 1 + conf.d/swclock | 6 ++++++ init.d/swclock.in | 5 +++-- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 conf.d/swclock diff --git a/conf.d/meson.build b/conf.d/meson.build index ce704180..cede4e76 100644 --- a/conf.d/meson.build +++ b/conf.d/meson.build @@ -7,6 +7,7 @@ conf_common = [ 'localmount', 'netmount', 'swap', + 'swclock', ] conf_net = [ diff --git a/conf.d/swclock b/conf.d/swclock new file mode 100644 index 00000000..f7c22063 --- /dev/null +++ b/conf.d/swclock @@ -0,0 +1,6 @@ +# This is the location of the reference file swclock uses to set the +# system date and time. +# This is the default path. If you are using it, you do not need to +# uncomment it. If you are using the default and have /var on its own +# file system, you need to add the appropriate rc_after setting. +# swclock_file=/var/lib/misc/openrc-shutdowntime diff --git a/init.d/swclock.in b/init.d/swclock.in index a85f4bae..63c052d1 100644 --- a/init.d/swclock.in +++ b/init.d/swclock.in @@ -10,6 +10,7 @@ # except according to the terms contained in the LICENSE file. description="Sets the local clock to the mtime of a given file." +swclock_file="${swclock_file:-/var/lib/misc/openrc-shutdowntime}" depend() { @@ -22,7 +23,7 @@ depend() start() { ebegin "Setting the local clock based on last shutdown time" - if ! swclock 2> /dev/null; then + if ! swclock "${swclock_file}" 2> /dev/null; then swclock --warn @SBINDIR@/openrc-run fi eend $? @@ -31,6 +32,6 @@ start() stop() { ebegin "Saving the shutdown time" - swclock --save + swclock --save "${swclock_file}" eend $? }