From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-890585-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id EA4851382F7
	for <garchives@archives.gentoo.org>; Wed,  6 Jul 2016 17:35:45 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 34D4FE0B16;
	Wed,  6 Jul 2016 17:35:44 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id C3BAEE0B16
	for <gentoo-commits@lists.gentoo.org>; Wed,  6 Jul 2016 17:35:43 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id D0FCA340CC8
	for <gentoo-commits@lists.gentoo.org>; Wed,  6 Jul 2016 17:35:41 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 09C252443
	for <gentoo-commits@lists.gentoo.org>; Wed,  6 Jul 2016 17:35:40 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org>
Message-ID: <1467825769.6074cbd651da7f27fc6fbc20a66f651c2577857b.williamh@OpenRC>
Subject: [gentoo-commits] proj/openrc:0.21.x commit in: init.d/
X-VCS-Repository: proj/openrc
X-VCS-Files: init.d/hwclock.in
X-VCS-Directories: init.d/
X-VCS-Committer: williamh
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: 6074cbd651da7f27fc6fbc20a66f651c2577857b
X-VCS-Branch: 0.21.x
Date: Wed,  6 Jul 2016 17:35:40 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: bbeb8f24-2155-4fae-beb4-e621f9c1a399
X-Archives-Hash: 8d3bc2ea392b2278e580069a3107deea

commit:     6074cbd651da7f27fc6fbc20a66f651c2577857b
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Jul  6 15:40:31 2016 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Jul  6 17:22:49 2016 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=6074cbd6

hwclock: always use --noadjfile if available

When we use the --utc or --localtime switch, also use --noadjfile if it
is available. This means hwclock will not use a drift file.

X-Gentoo-Bug: 584722
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=584722

 init.d/hwclock.in | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/init.d/hwclock.in b/init.d/hwclock.in
index d3e19f1..7fee7b7 100644
--- a/init.d/hwclock.in
+++ b/init.d/hwclock.in
@@ -69,6 +69,16 @@ _hwclock()
 	return 1
 }
 
+get_noadjfile()
+{
+	if ! yesno $clock_adjfile; then
+		# Some implementations don't handle adjustments
+		if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then
+			echo --noadjfile
+		fi
+	fi
+}
+
 start()
 {
 	local retval=0 errstr=""
@@ -91,16 +101,16 @@ start()
 	fi
 
 	# Always set the kernel's time zone.
-	_hwclock --systz $utc_cmd $clock_args
+	_hwclock --systz $utc_cmd $(get_noadjfile) $clock_args
 	: $(( retval += $? ))
 
 	if [ -e /etc/adjtime ] && yesno $clock_adjfile; then
-		_hwclock --adjust $utc_cmd
+		_hwclock --adjust $utc_cmd $(get_noadjfile)
 		: $(( retval += $? ))
 	fi
 
 	if yesno ${clock_hctosys:-YES}; then
-		_hwclock --hctosys $utc_cmd $clock_args
+		_hwclock --hctosys $utc_cmd $(get_noadjfile) $clock_args
 		: $(( retval += $? ))
 	fi
 
@@ -122,14 +132,7 @@ stop()
 
 	ebegin "Setting hardware clock using the system clock" "[$utc]"
 
-	if ! yesno $clock_adjfile; then
-		# Some implementations don't handle adjustments
-		if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then
-			utc_cmd="$utc_cmd --noadjfile"
-		fi
-	fi
-
-	_hwclock --systohc $utc_cmd $clock_args
+	_hwclock --systohc $utc_cmd $(get_noadjfile) $clock_args
 	retval=$?
 
 	eend $retval "Failed to sync clocks"
@@ -144,5 +147,5 @@ save()
 show()
 {
 	setupopts
-	hwclock --show "$utc_cmd" $clock_args
+	hwclock --show "$utc_cmd" $(get_noadjfile) $clock_args
 }