1 |
commit: 6a09bfd48b6caecf555d2c0d32394d9c2eccd2f1 |
2 |
Author: Anna Vyalkova <cyber <AT> sysrq <DOT> in> |
3 |
AuthorDate: Tue Apr 27 10:17:33 2021 +0000 |
4 |
Commit: Anna Vyalkova <cyber+gentoo <AT> sysrq <DOT> in> |
5 |
CommitDate: Tue Apr 27 10:17:44 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=6a09bfd4 |
7 |
|
8 |
net-misc/gmid: version bump to 1.6.1 |
9 |
|
10 |
also... |
11 |
* include patch from the application developer to make a pidfile |
12 |
* alter init.d script |
13 |
* update a live ebuild |
14 |
|
15 |
Package-Manager: Portage-3.0.18, Repoman-3.0.3 |
16 |
Signed-off-by: Anna Vyalkova <cyber <AT> sysrq.in> |
17 |
|
18 |
net-misc/gmid/Manifest | 2 +- |
19 |
net-misc/gmid/files/gmid-1.6.1-make-pidfile.patch | 111 +++++++++++++++++++++ |
20 |
net-misc/gmid/files/gmid.initd | 7 +- |
21 |
.../gmid/{gmid-1.6.ebuild => gmid-1.6.1.ebuild} | 4 +- |
22 |
net-misc/gmid/gmid-9999.ebuild | 12 +-- |
23 |
net-misc/gmid/metadata.xml | 1 - |
24 |
6 files changed, 117 insertions(+), 20 deletions(-) |
25 |
|
26 |
diff --git a/net-misc/gmid/Manifest b/net-misc/gmid/Manifest |
27 |
index 00cf99da9..636020c63 100644 |
28 |
--- a/net-misc/gmid/Manifest |
29 |
+++ b/net-misc/gmid/Manifest |
30 |
@@ -1 +1 @@ |
31 |
-DIST gmid-1.6.tar.gz 59402 BLAKE2B 1a13ae3f598a406e7920ad3a4f73cb230d70fe3bf4a1017d8d196ab80fdc0ffcf339ad79c64de93dc69d06e294132d714ad8ea1a5248dc69377e8d088f772d6c SHA512 cf118ac3b067b23d480006bccf36218ab0bf91d778092855a01706782fb0c68252157615d92d143d29deb8331422ef1263228b9eb53dd30e64a480b17c48af7a |
32 |
+DIST gmid-1.6.1.tar.gz 59488 BLAKE2B 147c8eb4e1c7195405fdce9bef8260e1a3acb145e9dfd2cb3fb126e4445685a3a1826906b01699429e98a61db6bb2089ec3399a1403323b36adf2555afc61bf2 SHA512 b98592e4bb5b1121fad07dc1fcbdbc95ce69a5648b3c2d22dba974511ae265255be62a330125c2da9b0b357edc2f24065fd8b475013d3d2023a8eded2c01a490 |
33 |
|
34 |
diff --git a/net-misc/gmid/files/gmid-1.6.1-make-pidfile.patch b/net-misc/gmid/files/gmid-1.6.1-make-pidfile.patch |
35 |
new file mode 100644 |
36 |
index 000000000..f95d583a7 |
37 |
--- /dev/null |
38 |
+++ b/net-misc/gmid/files/gmid-1.6.1-make-pidfile.patch |
39 |
@@ -0,0 +1,111 @@ |
40 |
+--- a/gmid.1 |
41 |
++++ b/gmid.1 |
42 |
+@@ -22,6 +22,7 @@ |
43 |
+ .Bk -words |
44 |
+ .Op Fl fnv |
45 |
+ .Op Fl c Ar config |
46 |
++.Op Fl P Ar pidfile |
47 |
+ .Ek |
48 |
+ .Nm |
49 |
+ .Bk -words |
50 |
+@@ -51,6 +52,10 @@ Specify the configuration file. |
51 |
+ Stays and logs on the foreground. |
52 |
+ .It Fl n |
53 |
+ Check that the configuration is valid, but don't start the server. |
54 |
++.It Fl P Pa pidfile |
55 |
++Write |
56 |
++.Nm |
57 |
++pid to the given path. |
58 |
+ .El |
59 |
+ .Pp |
60 |
+ If no configuration file is given, |
61 |
+--- a/gmid.c |
62 |
++++ b/gmid.c |
63 |
+@@ -316,7 +316,7 @@ static void |
64 |
+ usage(const char *me) |
65 |
+ { |
66 |
+ fprintf(stderr, |
67 |
+- "USAGE: %s [-fn] [-c config] | [-6h] [-d certs-dir] [-H host]\n" |
68 |
++ "USAGE: %s [-fn] [-c config] [-P pidfile] | [-6h] [-d certs-dir] [-H host]\n" |
69 |
+ " [-p port] [-x cgi] [dir]\n", |
70 |
+ me); |
71 |
+ } |
72 |
+@@ -411,6 +411,34 @@ serve(int argc, char **argv, struct imsgbuf *ibuf) |
73 |
+ _exit(executor_main(ibuf)); |
74 |
+ } |
75 |
+ |
76 |
++static int |
77 |
++write_pidfile(const char *pidfile) |
78 |
++{ |
79 |
++ struct flock lock; |
80 |
++ int fd; |
81 |
++ |
82 |
++ if (pidfile == NULL) |
83 |
++ return -1; |
84 |
++ |
85 |
++ if ((fd = open(pidfile, O_WRONLY|O_CREAT|O_CLOEXEC, 0600)) == -1) |
86 |
++ fatal("can't open pidfile %s: %s", pidfile, strerror(errno)); |
87 |
++ |
88 |
++ lock.l_start = 0; |
89 |
++ lock.l_len = 0; |
90 |
++ lock.l_type = F_WRLCK; |
91 |
++ lock.l_whence = SEEK_SET; |
92 |
++ |
93 |
++ if (fcntl(fd, F_SETLK, &lock) == -1) |
94 |
++ fatal("can't lock %s, gmid is already running?", pidfile); |
95 |
++ |
96 |
++ if (ftruncate(fd, 0) == -1) |
97 |
++ fatal("ftruncate: %s: %s", pidfile, strerror(errno)); |
98 |
++ |
99 |
++ dprintf(fd, "%d\n", getpid()); |
100 |
++ |
101 |
++ return fd; |
102 |
++} |
103 |
++ |
104 |
+ static void |
105 |
+ setup_configless(int argc, char **argv, const char *cgi) |
106 |
+ { |
107 |
+@@ -434,11 +462,12 @@ main(int argc, char **argv) |
108 |
+ { |
109 |
+ struct imsgbuf exibuf; |
110 |
+ int ch, conftest = 0, configless = 0; |
111 |
+- int old_ipv6, old_port; |
112 |
++ int pidfd, old_ipv6, old_port; |
113 |
++ const char *pidfile = NULL; |
114 |
+ |
115 |
+ init_config(); |
116 |
+ |
117 |
+- while ((ch = getopt(argc, argv, "6c:d:fH:hnp:vx:")) != -1) { |
118 |
++ while ((ch = getopt(argc, argv, "6c:d:fH:hnP:p:vx:")) != -1) { |
119 |
+ switch (ch) { |
120 |
+ case '6': |
121 |
+ conf.ipv6 = 1; |
122 |
+@@ -472,6 +501,10 @@ main(int argc, char **argv) |
123 |
+ conftest = 1; |
124 |
+ break; |
125 |
+ |
126 |
++ case 'P': |
127 |
++ pidfile = optarg; |
128 |
++ break; |
129 |
++ |
130 |
+ case 'p': |
131 |
+ conf.port = parse_portno(optarg); |
132 |
+ configless = 1; |
133 |
+@@ -536,6 +569,8 @@ main(int argc, char **argv) |
134 |
+ return 0; |
135 |
+ } |
136 |
+ |
137 |
++ pidfd = write_pidfile(pidfile); |
138 |
++ |
139 |
+ /* Linux seems to call the event handlers even when we're |
140 |
+ * doing a sigwait. These dummy handlers are here to avoid |
141 |
+ * being terminated on SIGHUP, SIGINT or SIGTERM. */ |
142 |
+@@ -604,5 +639,8 @@ main(int argc, char **argv) |
143 |
+ imsg_compose(&logibuf, IMSG_QUIT, 0, 0, -1, NULL, 0); |
144 |
+ imsg_flush(&logibuf); |
145 |
+ |
146 |
++ if (pidfd != -1) |
147 |
++ close(pidfd); |
148 |
++ |
149 |
+ return 0; |
150 |
+ } |
151 |
|
152 |
diff --git a/net-misc/gmid/files/gmid.initd b/net-misc/gmid/files/gmid.initd |
153 |
index 6607c7d2f..a5f3b9f7e 100644 |
154 |
--- a/net-misc/gmid/files/gmid.initd |
155 |
+++ b/net-misc/gmid/files/gmid.initd |
156 |
@@ -12,9 +12,8 @@ description_reload="Reload the gmid configuration without losing connections." |
157 |
GMID_CONFIGFILE=${GMID_CONFIGFILE:-/etc/gmid/gmid.conf} |
158 |
|
159 |
command="/usr/bin/gmid" |
160 |
-command_args="-c \"${GMID_CONFIGFILE}\" -f" |
161 |
-command_background=1 |
162 |
pidfile="/var/run/gmid.pid" |
163 |
+command_args="-c \"${GMID_CONFIGFILE}\" -P ${pidfile}" |
164 |
|
165 |
depend() { |
166 |
need net |
167 |
@@ -33,10 +32,6 @@ stop_pre() { |
168 |
fi |
169 |
} |
170 |
|
171 |
-stop_post() { |
172 |
- rm -f ${pidfile} |
173 |
-} |
174 |
- |
175 |
reload() { |
176 |
configtest || return 1 |
177 |
ebegin "Refreshing gmid's configuration" |
178 |
|
179 |
diff --git a/net-misc/gmid/gmid-1.6.ebuild b/net-misc/gmid/gmid-1.6.1.ebuild |
180 |
similarity index 94% |
181 |
rename from net-misc/gmid/gmid-1.6.ebuild |
182 |
rename to net-misc/gmid/gmid-1.6.1.ebuild |
183 |
index 3e844bfec..3f3f487a7 100644 |
184 |
--- a/net-misc/gmid/gmid-1.6.ebuild |
185 |
+++ b/net-misc/gmid/gmid-1.6.1.ebuild |
186 |
@@ -8,7 +8,7 @@ SSL_DAYS=36500 |
187 |
|
188 |
inherit ssl-cert toolchain-funcs |
189 |
|
190 |
-DESCRIPTION="simple and secure Gemini server" |
191 |
+DESCRIPTION="Simple and secure Gemini server" |
192 |
HOMEPAGE="https://www.omarpolo.com/pages/gmid.html" |
193 |
|
194 |
if [[ ${PV} == "9999" ]] ; then |
195 |
@@ -23,6 +23,8 @@ LICENSE="ISC" |
196 |
SLOT="0" |
197 |
IUSE="libressl" |
198 |
|
199 |
+PATCHES=( "${FILESDIR}"/${P}-make-pidfile.patch ) |
200 |
+ |
201 |
DEPEND="acct-user/gemini |
202 |
dev-libs/libevent |
203 |
!libressl? ( dev-libs/libretls ) |
204 |
|
205 |
diff --git a/net-misc/gmid/gmid-9999.ebuild b/net-misc/gmid/gmid-9999.ebuild |
206 |
index 3e844bfec..9398659da 100644 |
207 |
--- a/net-misc/gmid/gmid-9999.ebuild |
208 |
+++ b/net-misc/gmid/gmid-9999.ebuild |
209 |
@@ -8,7 +8,7 @@ SSL_DAYS=36500 |
210 |
|
211 |
inherit ssl-cert toolchain-funcs |
212 |
|
213 |
-DESCRIPTION="simple and secure Gemini server" |
214 |
+DESCRIPTION="Simple and secure Gemini server" |
215 |
HOMEPAGE="https://www.omarpolo.com/pages/gmid.html" |
216 |
|
217 |
if [[ ${PV} == "9999" ]] ; then |
218 |
@@ -33,16 +33,6 @@ RDEPEND="${DEPEND}" |
219 |
|
220 |
DOCS=( README.md ChangeLog ) |
221 |
|
222 |
-src_prepare() { |
223 |
- default |
224 |
- |
225 |
- # QA Notice: command not found |
226 |
- # remove `etags` from the "all" target |
227 |
- sed \ |
228 |
- -e "s/^\(all: .*\) TAGS \(.*\)$/\1 \2/" \ |
229 |
- -i Makefile || die |
230 |
-} |
231 |
- |
232 |
src_configure() { |
233 |
# note: not an autoconf configure script |
234 |
./configure \ |
235 |
|
236 |
diff --git a/net-misc/gmid/metadata.xml b/net-misc/gmid/metadata.xml |
237 |
index 2f806f847..db6c28fd0 100644 |
238 |
--- a/net-misc/gmid/metadata.xml |
239 |
+++ b/net-misc/gmid/metadata.xml |
240 |
@@ -6,7 +6,6 @@ |
241 |
<name>Omar Polo</name> |
242 |
<email>op@××××××××.com</email> |
243 |
</maintainer> |
244 |
- <changelog>https://git.omarpolo.com/gmid/tree/ChangeLog</changelog> |
245 |
</upstream> |
246 |
<maintainer type="person"> |
247 |
<email>cyber@×××××.in</email> |