1 |
commit: 47d734b5d4acb322b1db5b57a45e59c936380b06 |
2 |
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jun 1 21:48:45 2018 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jun 1 21:51:46 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=47d734b5 |
7 |
|
8 |
net-misc/omnisync: fix bugs, allow multiple instances |
9 |
|
10 |
Code bugs: |
11 |
- Fix --help display |
12 |
- Raise SHM unit limit |
13 |
- getopt loop failed to apply stats_file setting. |
14 |
|
15 |
Init improvement: |
16 |
- allow multiple instances. |
17 |
- write pidfile |
18 |
- declare that we use DNS (in case it starts before local resolver) |
19 |
|
20 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
21 |
Package-Manager: Portage-2.3.33, Repoman-2.3.9 |
22 |
|
23 |
net-misc/omnisync/files/omnisync-1.0-help.patch | 16 ++++++++ |
24 |
net-misc/omnisync/files/omnisync-1.0-maxshm.patch | 18 ++++++++ |
25 |
.../omnisync/files/omnisync-1.0-statfile.patch | 18 ++++++++ |
26 |
net-misc/omnisync/files/omnisync.initd | 11 ++++- |
27 |
net-misc/omnisync/omnisync-1.0-r1.ebuild | 48 ++++++++++++++++++++++ |
28 |
5 files changed, 109 insertions(+), 2 deletions(-) |
29 |
|
30 |
diff --git a/net-misc/omnisync/files/omnisync-1.0-help.patch b/net-misc/omnisync/files/omnisync-1.0-help.patch |
31 |
new file mode 100644 |
32 |
index 00000000000..47ff5201c03 |
33 |
--- /dev/null |
34 |
+++ b/net-misc/omnisync/files/omnisync-1.0-help.patch |
35 |
@@ -0,0 +1,16 @@ |
36 |
+main: fix help missing newline |
37 |
+ |
38 |
+Signed-off-by: Robin H. Johnson <robbat2@g.o> |
39 |
+ |
40 |
+diff -Nuar --exclude '*~' omnisync-1.0.orig/main.c omnisync-1.0/main.c |
41 |
+--- omnisync-1.0.orig/main.c 2009-01-02 01:03:20.000000000 -0800 |
42 |
++++ omnisync-1.0/main.c 2018-06-01 14:31:25.720686155 -0700 |
43 |
+@@ -139,7 +139,7 @@ |
44 |
+ printf("-c x community (snmp only)\n"); |
45 |
+ printf("-h x host to connect to\n"); |
46 |
+ printf("-u x ntpd shared memory unit\n"); |
47 |
+- printf("-z x do an initial step, to speed up syncing, parameter is number of samples"); |
48 |
++ printf("-z x do an initial step, to speed up syncing, parameter is number of samples\n"); |
49 |
+ printf("-S x write measurements to file x\n"); |
50 |
+ printf("-n do NOT submit to NTPd/set clock, query only (use in combination with -v and -f)\n"); |
51 |
+ printf("-f do not fork\n"); |
52 |
|
53 |
diff --git a/net-misc/omnisync/files/omnisync-1.0-maxshm.patch b/net-misc/omnisync/files/omnisync-1.0-maxshm.patch |
54 |
new file mode 100644 |
55 |
index 00000000000..678c6e0072d |
56 |
--- /dev/null |
57 |
+++ b/net-misc/omnisync/files/omnisync-1.0-maxshm.patch |
58 |
@@ -0,0 +1,18 @@ |
59 |
+main: raise SHM unit limit |
60 |
+ |
61 |
+Signed-off-by: Robin H. Johnson <robbat2@g.o> |
62 |
+ |
63 |
+diff -Nuar --exclude '*~' omnisync-1.0.orig/main.c omnisync-1.0/main.c |
64 |
+--- omnisync-1.0.orig/main.c 2009-01-02 01:03:20.000000000 -0800 |
65 |
++++ omnisync-1.0/main.c 2018-06-01 14:32:34.630066839 -0700 |
66 |
+@@ -346,8 +346,8 @@ |
67 |
+ unit_nr = atoi(optarg); |
68 |
+ if (unit_nr < 0) |
69 |
+ error_exit("-u requires a positive value\n"); |
70 |
+- if (unit_nr > 3) |
71 |
+- error_exit("NTPd normally supports only 4 shared memory devices, still continuing though\n"); |
72 |
++ if (unit_nr > 254) |
73 |
++ error_exit("NTPd normally supports only 254 shared memory devices\n"); |
74 |
+ break; |
75 |
+ |
76 |
+ case 'v': |
77 |
|
78 |
diff --git a/net-misc/omnisync/files/omnisync-1.0-statfile.patch b/net-misc/omnisync/files/omnisync-1.0-statfile.patch |
79 |
new file mode 100644 |
80 |
index 00000000000..972316a33bd |
81 |
--- /dev/null |
82 |
+++ b/net-misc/omnisync/files/omnisync-1.0-statfile.patch |
83 |
@@ -0,0 +1,18 @@ |
84 |
+main: wire up stats_file variable |
85 |
+ |
86 |
+Signed-off-by: Robin H. Johnson <robbat2@g.o> |
87 |
+ |
88 |
+diff -Nuar --exclude '*~' omnisync-1.0.orig/main.c omnisync-1.0/main.c |
89 |
+--- omnisync-1.0.orig/main.c 2009-01-02 01:03:20.000000000 -0800 |
90 |
++++ omnisync-1.0/main.c 2018-06-01 14:39:22.115229735 -0700 |
91 |
+@@ -358,6 +358,10 @@ |
92 |
+ version(); |
93 |
+ return 0; |
94 |
+ |
95 |
++ case 'S': |
96 |
++ stats_file = optarg; |
97 |
++ break; |
98 |
++ |
99 |
+ default: |
100 |
+ help(); |
101 |
+ return 1; |
102 |
|
103 |
diff --git a/net-misc/omnisync/files/omnisync.initd b/net-misc/omnisync/files/omnisync.initd |
104 |
index 7820af6e94e..c71e63d4d3e 100644 |
105 |
--- a/net-misc/omnisync/files/omnisync.initd |
106 |
+++ b/net-misc/omnisync/files/omnisync.initd |
107 |
@@ -3,11 +3,18 @@ |
108 |
# Distributed under the terms of the GNU General Public License v2 |
109 |
|
110 |
depend() { |
111 |
- use net |
112 |
+ use net dns |
113 |
} |
114 |
|
115 |
+INSTANCE=${SVCNAME#*.} |
116 |
+if [ -n "${INSTANCE}" ] && [ ${SVCNAME} != "omnisync" ]; then |
117 |
+ pidfile="/var/run/omnisync.${INSTANCE}.pid" |
118 |
+else |
119 |
+ pidfile="/var/run/omnisync.pid" |
120 |
+fi |
121 |
+ |
122 |
command="/usr/sbin/omnisync" |
123 |
-command_args="-M ${OMNISYNC_MODE} ${OMNISYNC_ARGS}" |
124 |
+command_args="-P ${pidfile} -M ${OMNISYNC_MODE} ${OMNISYNC_ARGS}" |
125 |
|
126 |
start_pre() { |
127 |
if [ -z "${OMNISYNC_MODE}" ] ; then |
128 |
|
129 |
diff --git a/net-misc/omnisync/omnisync-1.0-r1.ebuild b/net-misc/omnisync/omnisync-1.0-r1.ebuild |
130 |
new file mode 100644 |
131 |
index 00000000000..5875550ac80 |
132 |
--- /dev/null |
133 |
+++ b/net-misc/omnisync/omnisync-1.0-r1.ebuild |
134 |
@@ -0,0 +1,48 @@ |
135 |
+# Copyright 1999-2018 Gentoo Foundation |
136 |
+# Distributed under the terms of the GNU General Public License v2 |
137 |
+ |
138 |
+EAPI=6 |
139 |
+ |
140 |
+inherit toolchain-funcs |
141 |
+ |
142 |
+DESCRIPTION="A driver for NTPd for people who are firewall-challenged" |
143 |
+HOMEPAGE="https://www.vanheusden.com/time/omnisync" |
144 |
+LICENSE="GPL-2" |
145 |
+SRC_URI="https://www.vanheusden.com/time/${PN}/${P}.tgz" |
146 |
+ |
147 |
+SLOT="0" |
148 |
+KEYWORDS="~amd64 ~x86" |
149 |
+IUSE="debug" |
150 |
+ |
151 |
+RDEPEND="dev-libs/openssl:0= net-analyzer/net-snmp:=" |
152 |
+DEPEND="${RDEPEND}" |
153 |
+DOCS=( readme.txt Changes ) |
154 |
+PATCHES=( |
155 |
+ "${FILESDIR}"/omnisync-1.0-help.patch |
156 |
+ "${FILESDIR}"/omnisync-1.0-maxshm.patch |
157 |
+ "${FILESDIR}"/omnisync-1.0-statfile.patch |
158 |
+) |
159 |
+ |
160 |
+src_prepare() { |
161 |
+ default |
162 |
+ tc-export CC |
163 |
+ sed -i \ |
164 |
+ -e 's/-O2 -Wall/-Wall/' \ |
165 |
+ -e 's/-lsnmp/-lnetsnmp/' \ |
166 |
+ "${S%/}/Makefile" || die |
167 |
+ use debug || sed -i -e 's/$(DEBUG)//' "${S%/}/Makefile" || die |
168 |
+} |
169 |
+ |
170 |
+src_install() { |
171 |
+ dosbin omnisync |
172 |
+ newinitd "${FILESDIR%/}/${PN}.initd" ${PN} |
173 |
+ newconfd "${FILESDIR%/}/${PN}.confd" ${PN} |
174 |
+ einstalldocs |
175 |
+} |
176 |
+ |
177 |
+pkg_postinst() { |
178 |
+ local isConfigured=$(grep 'OMNISYNC_MODE=""' "${ROOT%/}/etc/conf.d/${PN}") |
179 |
+ if [[ -n "${isConfigured}" ]] ; then |
180 |
+ elog "Be sure to configure ${PN} in ${ROOT%/}/etc/conf.d before trying to start the service" |
181 |
+ fi |
182 |
+} |