1 |
commit: 6e9478074f14ff36bd4beb516f8ba144bef45201 |
2 |
Author: Jeroen Roovers <jer <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Sep 4 09:31:04 2018 +0000 |
4 |
Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 4 09:32:19 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e947807 |
7 |
|
8 |
net-misc/chrony: Set default PID file and check for it |
9 |
|
10 |
Fixes: https://bugs.gentoo.org/665212 |
11 |
Package-Manager: Portage-2.3.49, Repoman-2.3.10 |
12 |
|
13 |
...y-3.4_pre1.ebuild => chrony-3.4_pre1-r1.ebuild} | 12 ++-- |
14 |
net-misc/chrony/files/chronyd.init-r2 | 70 ++++++++++++++++++++++ |
15 |
2 files changed, 76 insertions(+), 6 deletions(-) |
16 |
|
17 |
diff --git a/net-misc/chrony/chrony-3.4_pre1.ebuild b/net-misc/chrony/chrony-3.4_pre1-r1.ebuild |
18 |
similarity index 93% |
19 |
rename from net-misc/chrony/chrony-3.4_pre1.ebuild |
20 |
rename to net-misc/chrony/chrony-3.4_pre1-r1.ebuild |
21 |
index c3aed38aa99..a39dc7b24dc 100644 |
22 |
--- a/net-misc/chrony/chrony-3.4_pre1.ebuild |
23 |
+++ b/net-misc/chrony/chrony-3.4_pre1-r1.ebuild |
24 |
@@ -38,9 +38,8 @@ S="${WORKDIR}/${P/_/-}" |
25 |
|
26 |
src_prepare() { |
27 |
sed -i \ |
28 |
- -e 's:/etc/chrony\.:/etc/chrony/chrony.:g' \ |
29 |
- -e 's:/var/run:/run:g' \ |
30 |
- conf.c doc/*.man.in examples/* || die |
31 |
+ -e 's:/etc/chrony\.conf:/etc/chrony/chrony.conf:g' \ |
32 |
+ doc/* examples/* || die |
33 |
|
34 |
default |
35 |
} |
36 |
@@ -75,12 +74,13 @@ src_configure() { |
37 |
$(usex rtc '' --disable-rtc) \ |
38 |
${CHRONY_EDITLINE} \ |
39 |
${EXTRA_ECONF} \ |
40 |
- --docdir=/usr/share/doc/${PF} \ |
41 |
--chronysockdir=/run/chrony \ |
42 |
+ --disable-sechash \ |
43 |
+ --docdir=/usr/share/doc/${PF} \ |
44 |
--mandir=/usr/share/man \ |
45 |
--prefix=/usr \ |
46 |
--sysconfdir=/etc/chrony \ |
47 |
- --disable-sechash \ |
48 |
+ --with-pidfile="${EPREFIX}/run/chrony/chronyd.pid" |
49 |
--without-nss \ |
50 |
--without-tomcrypt |
51 |
" |
52 |
@@ -97,7 +97,7 @@ src_compile() { |
53 |
src_install() { |
54 |
default |
55 |
|
56 |
- newinitd "${FILESDIR}"/chronyd.init-r1 chronyd |
57 |
+ newinitd "${FILESDIR}"/chronyd.init-r2 chronyd |
58 |
newconfd "${FILESDIR}"/chronyd.conf chronyd |
59 |
|
60 |
insinto /etc/${PN} |
61 |
|
62 |
diff --git a/net-misc/chrony/files/chronyd.init-r2 b/net-misc/chrony/files/chronyd.init-r2 |
63 |
new file mode 100644 |
64 |
index 00000000000..4892a57b163 |
65 |
--- /dev/null |
66 |
+++ b/net-misc/chrony/files/chronyd.init-r2 |
67 |
@@ -0,0 +1,70 @@ |
68 |
+#!/sbin/openrc-run |
69 |
+# Copyright 1999-2018 Gentoo Foundation |
70 |
+# Distributed under the terms of the GNU General Public License v2 |
71 |
+ |
72 |
+depend() { |
73 |
+ use dns |
74 |
+} |
75 |
+ |
76 |
+checkconfig() { |
77 |
+ # Note that /etc/chrony/chrony.keys is *NOT* checked. This |
78 |
+ # is because the user may have specified another key |
79 |
+ # file, and we don't want to force the user to use that |
80 |
+ # exact name for the key file. |
81 |
+ if [ ! -f "${CFGFILE}" ] ; then |
82 |
+ eerror "Please create ${CFGFILE} and the" |
83 |
+ eerror "chrony key file (usually /etc/chrony/chrony.keys)" |
84 |
+ eerror "by using the" |
85 |
+ eerror "" |
86 |
+ eerror " chrony.conf.example" |
87 |
+ eerror " chrony.keys.example" |
88 |
+ eerror "" |
89 |
+ eerror "files (from the documentation directory)" |
90 |
+ eerror "as templates." |
91 |
+ return 1 |
92 |
+ else |
93 |
+ # Actually, I tried it, and chrony seems to ignore the pidfile |
94 |
+ # option. I'm going to leave it here anyway, since you never |
95 |
+ # know if it might be handy |
96 |
+ PIDFILE=`awk '/^ *pidfile/{print $2}' "${CFGFILE}"` |
97 |
+ [ -z "${PIDFILE}" ] && PIDFILE=/run/chrony/chronyd.pid |
98 |
+ fi |
99 |
+ return 0 |
100 |
+} |
101 |
+ |
102 |
+setxtrarg() { |
103 |
+ if [ -c /dev/rtc ]; then |
104 |
+ grep -q '^rtcfile' "${CFGFILE}" && ARGS="${ARGS} -s" |
105 |
+ fi |
106 |
+ grep -q '^dumponexit$' "${CFGFILE}" && ARGS="${ARGS} -r" |
107 |
+ return 0 |
108 |
+} |
109 |
+ |
110 |
+start() { |
111 |
+ checkconfig || return $? |
112 |
+ setxtrarg |
113 |
+ |
114 |
+ [ -n "${PIDFILE}" ] || PIDFILE=/run/chronyd.pid |
115 |
+ |
116 |
+ ebegin "Starting chronyd" |
117 |
+ start-stop-daemon \ |
118 |
+ --start \ |
119 |
+ --quiet \ |
120 |
+ --exec /usr/sbin/chronyd \ |
121 |
+ --pidfile "${PIDFILE}" \ |
122 |
+ -- -f "${CFGFILE}" ${ARGS} |
123 |
+ eend $? "Failed to start chronyd" |
124 |
+} |
125 |
+ |
126 |
+stop() { |
127 |
+ checkconfig || return $? |
128 |
+ |
129 |
+ [ -n "${PIDFILE}" ] || PIDFILE=/run/chronyd.pid |
130 |
+ |
131 |
+ ebegin "Stopping chronyd" |
132 |
+ start-stop-daemon \ |
133 |
+ --stop \ |
134 |
+ --quiet \ |
135 |
+ --pidfile "${PIDFILE}" |
136 |
+ eend $? "Failed to stop chronyd" |
137 |
+} |