Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: init.d/
Date: Wed, 06 Jul 2016 17:24:11
Message-Id: 1467819631.ac8ad169ae59fece38066c2e08ff57d53d737edd.williamh@OpenRC
1 commit: ac8ad169ae59fece38066c2e08ff57d53d737edd
2 Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
3 AuthorDate: Wed Jul 6 15:40:31 2016 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 6 15:40:31 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=ac8ad169
7
8 hwclock: always use --noadjfile if available
9
10 When we use the --utc or --localtime switch, also use --noadjfile if it
11 is available. This means hwclock will not use a drift file.
12
13 X-Gentoo-Bug: 584722
14 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=584722
15
16 init.d/hwclock.in | 27 +++++++++++++++------------
17 1 file changed, 15 insertions(+), 12 deletions(-)
18
19 diff --git a/init.d/hwclock.in b/init.d/hwclock.in
20 index d3e19f1..7fee7b7 100644
21 --- a/init.d/hwclock.in
22 +++ b/init.d/hwclock.in
23 @@ -69,6 +69,16 @@ _hwclock()
24 return 1
25 }
26
27 +get_noadjfile()
28 +{
29 + if ! yesno $clock_adjfile; then
30 + # Some implementations don't handle adjustments
31 + if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then
32 + echo --noadjfile
33 + fi
34 + fi
35 +}
36 +
37 start()
38 {
39 local retval=0 errstr=""
40 @@ -91,16 +101,16 @@ start()
41 fi
42
43 # Always set the kernel's time zone.
44 - _hwclock --systz $utc_cmd $clock_args
45 + _hwclock --systz $utc_cmd $(get_noadjfile) $clock_args
46 : $(( retval += $? ))
47
48 if [ -e /etc/adjtime ] && yesno $clock_adjfile; then
49 - _hwclock --adjust $utc_cmd
50 + _hwclock --adjust $utc_cmd $(get_noadjfile)
51 : $(( retval += $? ))
52 fi
53
54 if yesno ${clock_hctosys:-YES}; then
55 - _hwclock --hctosys $utc_cmd $clock_args
56 + _hwclock --hctosys $utc_cmd $(get_noadjfile) $clock_args
57 : $(( retval += $? ))
58 fi
59
60 @@ -122,14 +132,7 @@ stop()
61
62 ebegin "Setting hardware clock using the system clock" "[$utc]"
63
64 - if ! yesno $clock_adjfile; then
65 - # Some implementations don't handle adjustments
66 - if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then
67 - utc_cmd="$utc_cmd --noadjfile"
68 - fi
69 - fi
70 -
71 - _hwclock --systohc $utc_cmd $clock_args
72 + _hwclock --systohc $utc_cmd $(get_noadjfile) $clock_args
73 retval=$?
74
75 eend $retval "Failed to sync clocks"
76 @@ -144,5 +147,5 @@ save()
77 show()
78 {
79 setupopts
80 - hwclock --show "$utc_cmd" $clock_args
81 + hwclock --show "$utc_cmd" $(get_noadjfile) $clock_args
82 }