[Marco d'Itri]
> Petter determined that this works. I think that the real problem is
> that the RUN rules in 85-hwclock.rules are only executed if
> ENV{BADYEAR} exists.

Could be.

> Importing /etc/default/rcS as if were a list of variables looks like
> a bad idea to me anyway, so please replace the file with a single
> RUN rule which runs a shell script which properly sources
> /etc/default/rcS and then runs hwclock if needed.

If this is the case, this patch should solve it.  It is tested and
worked for me.

diff -urN ../util-linux-2.16.1/debian/hwclock-set 
../util-linux-2.16.1-pere/debian/hwclock-set
--- ../util-linux-2.16.1/debian/hwclock-set     1970-01-01 01:00:00.000000000 
+0100
+++ ../util-linux-2.16.1-pere/debian/hwclock-set        2009-10-05 
11:06:14.545110000 +0200
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Reset the System Clock to UTC if the hardware clock from which it
+# was copied by the kernel was in localtime.
+
+dev=$1
+
+if [ -f /etc/default/rcS ] ; then
+    . /etc/default/rcS
+fi     
+
+if [ yes != "$UTC" ] ; then
+    if [ yes = "$BADYEAR" ] ; then
+       /sbin/hwclock --rtc=$dev --systz --localtime --noadjfile --badyear
+    else
+       /sbin/hwclock --rtc=$dev --systz --localtime --noadjfile
+    fi
+fi
diff -urN ../util-linux-2.16.1/debian/hwclock.rules 
../util-linux-2.16.1-pere/debian/hwclock.rules
--- ../util-linux-2.16.1/debian/hwclock.rules   2009-10-05 11:02:20.000000000 
+0200
+++ ../util-linux-2.16.1-pere/debian/hwclock.rules      2009-10-05 
11:08:07.970856000 +0200
@@ -1,8 +1,4 @@
 # Reset the System Clock to UTC if the hardware clock from which it was
 # copied by the kernel was in localtime.
 
-KERNEL=="rtc0", IMPORT{file}="/etc/default/rcS"
-KERNEL=="rtc0", ENV{UTC}!="yes", ENV{BADYEAR}!="yes", \
-       RUN+="/sbin/hwclock --rtc=$root/$name --systz --localtime --noadjfile"
-KERNEL=="rtc0", ENV{UTC}!="yes", ENV{BADYEAR}=="yes", \
-       RUN+="/sbin/hwclock --rtc=$root/$name --systz --localtime --noadjfile 
--badyear"
+KERNEL=="rtc0", RUN+="/lib/udev/hwclock-set $root/$name"
diff -urN ../util-linux-2.16.1/debian/rules 
../util-linux-2.16.1-pere/debian/rules
--- ../util-linux-2.16.1/debian/rules   2009-10-05 11:02:20.000000000 +0200
+++ ../util-linux-2.16.1-pere/debian/rules      2009-10-05 11:04:16.430037000 
+0200
@@ -117,6 +117,7 @@
        fi
        if [ -f debian/util-linux/sbin/hwclock ] ; then \
            install -m 644 debian/hwclock.rules 
debian/util-linux/lib/udev/rules.d/85-hwclock.rules; \
+           install -m 755 debian/hwclock-set 
debian/util-linux/lib/udev/hwclock-set; \
        fi
        # copy blkid library and symlink into udeb
        ln debian/libblkid1/lib/libblkid.so.1.* debian/libblkid1-udeb/lib/


On IRC (#pkg-sysvinit), Scott James Remnant mentioned that a better
fix is probably to assume the hwclock is set to UTC in the early boot,
and just adjust it with the time zone when the zone info is available
without consulting the hardware clock.  It would avoid all these
issues completely, but I got the impression it require a new upstream
version of util-linux.

Happy hacking,
-- 
Petter Reinholdtsen



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to