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

Bug#659611: clock-setup: Please support /etc/default/hwclock



Package: clock-setup
Version: 0.109
Severity: important
Tags: patch

Hi,

In order to resolve bugs including #659451 and permit
/etc/default/rcS to become a regular conffile, I'd like to
move the UTC variable from /etc/default/rcS to
/etc/default/hwclock.  This would require clock-setup to
be patched before this can be fixed in initscripts, to
avoid breakage.  A patch is attached which makes clock-setup
use /etc/default/hwclock, but fall back to /etc/default/rcS
for backward compatibility if not present.  I'd appreciate
it if you would consider applying it.


Regards,
Roger

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (550, 'unstable'), (500, 'testing'), (400, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
>From a3878e9c14e4283a43afd34cefbf88e8fa36fa2f Mon Sep 17 00:00:00 2001
From: Roger Leigh <rleigh@debian.org>
Date: Sun, 12 Feb 2012 14:41:59 +0000
Subject: [PATCH] 10clock-setup: Support /etc/default/hwclock

/etc/default/hwclock supersedes /etc/default/rcS as the location
for the UTC configuration option.  Use /etc/default/hwclock, but
fall back to /etc/default/rcS if it is not present, for backward
compatibility.
---
 finish-install.d/10clock-setup |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/finish-install.d/10clock-setup b/finish-install.d/10clock-setup
index f825bb8..c80f1dd 100755
--- a/finish-install.d/10clock-setup
+++ b/finish-install.d/10clock-setup
@@ -92,14 +92,18 @@ if ! db_go; then
 fi
 
 # Update target system configuration for utc/localtime selection
-rcsfile=/target/etc/default/rcS
+if [ -f /target/etc/default/hwclock ]; then
+	utcfile=/target/etc/default/hwclock
+else
+	utcfile=/target/etc/default/rcS
+fi
 
 db_get clock-setup/utc
 if [ "$RET" = true ]; then
-	sed -i -e 's:^UTC="no":UTC="yes":' -e 's:^UTC=no:UTC=yes:' $rcsfile
+	sed -i -e 's:^UTC="no":UTC="yes":' -e 's:^UTC=no:UTC=yes:' $utcfile
 	OPT="--utc"
 else
-	sed -i -e 's:^UTC="yes":UTC="no":' -e 's:^UTC=yes:UTC=no:' $rcsfile
+	sed -i -e 's:^UTC="yes":UTC="no":' -e 's:^UTC=yes:UTC=no:' $utcfile
 	OPT="--localtime"
 fi
 
-- 
1.7.9


Reply to: