[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#763777: [PATCH initramfs-tools] hooks/fsck: Add hwclock, related configuration files and udev rules



Closes: #763777
---
This worked for me in a VM with RTC set to local time and booting with
systemd.  The system time looks correct if I use break=mount and is
still correct after completing boot.

It doesn't work with sysvinit/initscripts; util-linux needs to be
patched as in #763823.

Ben.

 hooks/fsck | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/hooks/fsck b/hooks/fsck
index 77b40d1..cc860b5 100755
--- a/hooks/fsck
+++ b/hooks/fsck
@@ -94,6 +94,20 @@ fi
 copy_exec /sbin/fsck
 copy_exec /sbin/logsave
 copy_exec /sbin/sulogin
+
+# fsck may spuriously fail or warn if the system time is not yet correct
+if [ -x /lib/udev/hwclock-set ]; then
+	copy_exec /lib/udev/hwclock-set
+	copy_exec /sbin/hwclock
+	for f in /etc/adjtime /etc/default/hwclock /etc/default/rcS \
+	         /etc/localtime /etc/udev/rules.d/*-hwclock.rules \
+		 /lib/udev/rules.d/*-hwclock.rules; do
+		if [ -f "$f" ]; then
+			copy_exec "$f"
+		fi
+	done
+fi
+
 for type in $(get_fstypes | sort | uniq); do
 	if [ "$type" = 'auto' ] ; then
 		echo "Warning: couldn't identify filesystem type for fsck hook, ignoring."

-- 
Ben Hutchings
Everything should be made as simple as possible, but not simpler.
                                                           - Albert Einstein

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: