Bug#660093: clock-setup: Please support /etc/adjtime in addition to /etc/default

2012-05-21 Thread Roger Leigh
On Thu, Feb 16, 2012 at 11:10:42AM +, Roger Leigh wrote:

The following patch is also required to remove the use of
/etc/default/hwclock given that we never used it for the UTC
setting, since we moved it to /etc/adjtime directly.


Thanks,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?   http://gutenprint.sourceforge.net/
   `-GPG Public Key: 0x25BFB848   Please GPG sign your mail.
From c21d1791ae7a34ea85bcd9544bf811b944fc2777 Mon Sep 17 00:00:00 2001
From: Roger Leigh 
Date: Mon, 21 May 2012 20:06:26 +0100
Subject: [PATCH] 10clock-setup: Revert use of /etc/default/hwclock

This was never used for the UTC setting given that we migrate it
directly from /etc/default/rcS, so it's no longer needed it
clock-setup.
---
 debian/changelog   |7 ++-
 finish-install.d/10clock-setup |6 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3e627c7..3b3912a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,7 +6,12 @@ clock-setup (0.111) UNRELEASED; urgency=low
   [ Joey Hess ]
   * Set UTC or LOCAL in /etc/adjtime for systemd. Closes: #660093
 
- -- Samuel Thibault   Sun, 12 Feb 2012 23:05:52 +0100
+  [ Roger Leigh ]
+  * Migrate UTC setting from /etc/default/rcS; revert use of
+/etc/default/hwclock, which is not used for holding the UTC
+setting.
+
+ -- Roger Leigh   Mon, 21 May 2012 20:03:36 +0100
 
 clock-setup (0.110) unstable; urgency=low
 
diff --git a/finish-install.d/10clock-setup b/finish-install.d/10clock-setup
index 4e52af5..42c9a08 100755
--- a/finish-install.d/10clock-setup
+++ b/finish-install.d/10clock-setup
@@ -92,11 +92,7 @@ if ! db_go; then
 fi
 
 # Update target system configuration for utc/localtime selection
-if [ -f /target/etc/default/hwclock ]; then
-	utcfile=/target/etc/default/hwclock
-else
-	utcfile=/target/etc/default/rcS
-fi
+utcfile=/target/etc/default/rcS
 
 db_get clock-setup/utc
 if [ "$RET" = true ]; then
-- 
1.7.10



signature.asc
Description: Digital signature


Bug#660093: clock-setup: Please support /etc/adjtime in addition to /etc/default

2012-02-16 Thread Roger Leigh
Package: clock-setup
Version: 0.110
Severity: normal
Tags: patch

Hi,

This is similar to the patch for hwclock support last week, but
solves a different problem, namely supporting systemd in d-i,
and (potentially) allowing migration of the UTC setting in
/etc/default into the native configuration file for this option.


Many thanks,
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 8ca1790120e851c34e5dffa7adb20322ef6c970a Mon Sep 17 00:00:00 2001
From: Roger Leigh 
Date: Thu, 16 Feb 2012 10:41:03 +
Subject: [PATCH] 10clock-setup: Support /etc/adjtime

Set UTC or LOCAL in /etc/adjtime in addition to UTC= in /etc/default.
This is because /etc/adjtime is the configuration file for hwclock,
and the systemd init daemon uses the configuration file directly,
thus this change makes it possible for d-i to support installations
which use systemd in place of sysvinit.  This change does not affect
sysvinit users, because /etc/adjtime is updated when hwclock is run.
---
 finish-install.d/10clock-setup |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/finish-install.d/10clock-setup b/finish-install.d/10clock-setup
index 4bde2c4..4e52af5 100755
--- a/finish-install.d/10clock-setup
+++ b/finish-install.d/10clock-setup
@@ -101,9 +101,15 @@ fi
 db_get clock-setup/utc
 if [ "$RET" = true ]; then
 	sed -i -e 's:^UTC="no":UTC="yes":' -e 's:^UTC=no:UTC=yes:' $utcfile
+	if [ -e /target/etc/adjtime ]; then
+		sed -i -e 's:^LOCAL$:UTC:' /target/etc/adjtime
+	fi
 	OPT="--utc"
 else
 	sed -i -e 's:^UTC="yes":UTC="no":' -e 's:^UTC=yes:UTC=no:' $utcfile
+	if [ -e /target/etc/adjtime ]; then
+		sed -i -e 's:^UTC$:LOCAL:' /target/etc/adjtime
+	fi
 	OPT="--localtime"
 fi
 
-- 
1.7.9