1 |
commit: 3c5d8a46a252853fd8b54c8c6537e08b768fbc7a |
2 |
Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Mar 1 12:54:02 2022 +0000 |
4 |
Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Mar 1 12:54:13 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c5d8a46 |
7 |
|
8 |
www-servers/webfs: Add webfsd |
9 |
|
10 |
Package-Manager: Portage-3.0.30, Repoman-3.0.3 |
11 |
Signed-off-by: Alexey Shvetsov <alexxy <AT> gentoo.org> |
12 |
|
13 |
www-servers/webfs/Manifest | 1 + |
14 |
.../webfs/files/webfs-1.21-CVE-2013-0347.patch | 15 ++++++ |
15 |
...riables.mk-dont-strip-binaries-on-install.patch | 12 +++++ |
16 |
www-servers/webfs/files/webfs.confd | 27 +++++++++++ |
17 |
www-servers/webfs/files/webfs.initd | 29 ++++++++++++ |
18 |
www-servers/webfs/files/webfs.service | 10 ++++ |
19 |
www-servers/webfs/files/webfs.service.conf | 27 +++++++++++ |
20 |
www-servers/webfs/metadata.xml | 8 ++++ |
21 |
www-servers/webfs/webfs-1.21.ebuild | 55 ++++++++++++++++++++++ |
22 |
9 files changed, 184 insertions(+) |
23 |
|
24 |
diff --git a/www-servers/webfs/Manifest b/www-servers/webfs/Manifest |
25 |
new file mode 100644 |
26 |
index 000000000000..7736407698cb |
27 |
--- /dev/null |
28 |
+++ b/www-servers/webfs/Manifest |
29 |
@@ -0,0 +1 @@ |
30 |
+DIST webfs-1.21.tar.gz 44249 BLAKE2B 3d1bf7023f271f06079378a9a8e957deb611d567209ebd0ee947cae9852aecc2704ec8ce115b1f03ec39299040f44d7caf53fb30241f4990521aeda7b5815f3f SHA512 68b9b3163a21be8a549e395295b27dd8ce9b575183d6c36b05b98bdc310917cf2dc653ff73bdb78a8c063674a8e9480211ec5c28b8a676f9cee41fa962cfd473 |
31 |
|
32 |
diff --git a/www-servers/webfs/files/webfs-1.21-CVE-2013-0347.patch b/www-servers/webfs/files/webfs-1.21-CVE-2013-0347.patch |
33 |
new file mode 100644 |
34 |
index 000000000000..26e225def360 |
35 |
--- /dev/null |
36 |
+++ b/www-servers/webfs/files/webfs-1.21-CVE-2013-0347.patch |
37 |
@@ -0,0 +1,15 @@ |
38 |
+--- ./webfsd.c |
39 |
++++ ./webfsd.c |
40 |
+@@ -918,8 +918,11 @@ |
41 |
+ } else { |
42 |
+ if (NULL == (logfh = fopen(logfile,"a"))) |
43 |
+ xperror(LOG_WARNING,"open access log",NULL); |
44 |
+- else |
45 |
++ else { |
46 |
+ close_on_exec(fileno(logfh)); |
47 |
++ if (0 != chmod(logfile,S_IRUSR|S_IWUSR)) |
48 |
++ xperror(LOG_WARNING,"chmod access log",NULL); |
49 |
++ } |
50 |
+ } |
51 |
+ } |
52 |
+ |
53 |
|
54 |
diff --git a/www-servers/webfs/files/webfs-1.21-Variables.mk-dont-strip-binaries-on-install.patch b/www-servers/webfs/files/webfs-1.21-Variables.mk-dont-strip-binaries-on-install.patch |
55 |
new file mode 100644 |
56 |
index 000000000000..03f2f5c59816 |
57 |
--- /dev/null |
58 |
+++ b/www-servers/webfs/files/webfs-1.21-Variables.mk-dont-strip-binaries-on-install.patch |
59 |
@@ -0,0 +1,12 @@ |
60 |
+diff -Naur webfs-1.21.orig/mk/Variables.mk webfs-1.21/mk/Variables.mk |
61 |
+--- webfs-1.21.orig/mk/Variables.mk 2009-02-03 01:14:18.000000000 +0100 |
62 |
++++ webfs-1.21/mk/Variables.mk 2009-02-03 01:16:01.000000000 +0100 |
63 |
+@@ -23,7 +23,7 @@ |
64 |
+ CXX ?= g++ |
65 |
+ MOC ?= $(if $(QTDIR),$(QTDIR)/bin/moc,moc) |
66 |
+ INSTALL ?= install |
67 |
+-INSTALL_BINARY := $(INSTALL) -s |
68 |
++INSTALL_BINARY := $(INSTALL) |
69 |
+ INSTALL_SCRIPT := $(INSTALL) |
70 |
+ INSTALL_DATA := $(INSTALL) -m 644 |
71 |
+ INSTALL_DIR := $(INSTALL) -d |
72 |
|
73 |
diff --git a/www-servers/webfs/files/webfs.confd b/www-servers/webfs/files/webfs.confd |
74 |
new file mode 100644 |
75 |
index 000000000000..5c4de3ad9b74 |
76 |
--- /dev/null |
77 |
+++ b/www-servers/webfs/files/webfs.confd |
78 |
@@ -0,0 +1,27 @@ |
79 |
+# Configuration for webfsd init script |
80 |
+ |
81 |
+WEBFS_PORT=80 |
82 |
+WEBFS_DOCROOT=/var/www/localhost/htdocs |
83 |
+WEBFS_INDEX=index.html |
84 |
+WEBFS_LOG=/var/log/webfsd.log |
85 |
+ |
86 |
+# set server name |
87 |
+#WEBFS_SERVNAME= |
88 |
+ |
89 |
+# uncomment to chroot to specified dir |
90 |
+#WEBFS_CHROOT="/var/www/localhost" |
91 |
+ |
92 |
+# max allowed connections (defaults to 32) |
93 |
+#WEBFS_MAXCONN=50 |
94 |
+ |
95 |
+# uncomment to enable directory listings |
96 |
+#WEBFS_DIR_LIST=true |
97 |
+ |
98 |
+# uncomment to enable SSL (you'll need to add -C <cert> -P <pass> to WEBFS_OPTS) |
99 |
+#WEBFS_SSL=true |
100 |
+ |
101 |
+# uncomment to enable ipv6 |
102 |
+#WEBFS_IPV6=true |
103 |
+ |
104 |
+# Add any extra options here. See webfsd for more information. |
105 |
+#WEBFS_OPTS="" |
106 |
|
107 |
diff --git a/www-servers/webfs/files/webfs.initd b/www-servers/webfs/files/webfs.initd |
108 |
new file mode 100644 |
109 |
index 000000000000..ec328b662f83 |
110 |
--- /dev/null |
111 |
+++ b/www-servers/webfs/files/webfs.initd |
112 |
@@ -0,0 +1,29 @@ |
113 |
+#!/sbin/openrc-run |
114 |
+# Copyright 1999-2022 Gentoo Authors |
115 |
+# Distributed under the terms of the GNU General Public License v2 |
116 |
+ |
117 |
+depend() { |
118 |
+ need net |
119 |
+} |
120 |
+ |
121 |
+start() { |
122 |
+ WEBFS_OPTS="-p ${WEBFS_PORT:-80} -f ${WEBFS_INDEX:-index.html} ${WEBFS_OPTS}" |
123 |
+ [ -n "${WEBFS_DOCROOT}" ] && WEBFS_OPTS="${WEBFS_OPTS} -r ${WEBFS_DOCROOT}" |
124 |
+ [ -n "${WEBFS_CHROOT}" ] && WEBFS_OPTS="${WEBFS_OPTS} -R ${WEBFS_CHROOT}" |
125 |
+ [ -n "${WEBFS_LOG}" ] && WEBFS_OPTS="${WEBFS_OPTS} -L ${WEBFS_LOG}" |
126 |
+ [ -n "${WEBFS_MAXCONN}" ] && WEBFS_OPTS="${WEBFS_OPTS} -c ${WEBFS_MAXCONN}" |
127 |
+ [ -n "${WEBFS_IPV6}" ] && WEBFS_OPTS="${WEBFS_OPTS} -6" |
128 |
+ [ -n "${WEBFS_SSL}" ] && WEBFS_OPTS="${WEBFS_OPTS} -S" |
129 |
+ [ -n "${WEBFS_SERVNAME}" ] && WEBFS_OPTS="${WEBFS_OPTS} -n ${WEBFS_SERVNAME}" |
130 |
+ [ -n "${WEBFS_DIR_LIST}" ] || WEBFS_OPTS="${WEBFS_OPTS} -j" |
131 |
+ |
132 |
+ ebegin "Starting webfsd" |
133 |
+ start-stop-daemon --start --quiet --exec /usr/bin/webfsd -- ${WEBFS_OPTS} |
134 |
+ eend $? "Failed to start webfsd" |
135 |
+} |
136 |
+ |
137 |
+stop() { |
138 |
+ ebegin "Stopping webfsd" |
139 |
+ start-stop-daemon --stop --quiet --exec /usr/bin/webfsd |
140 |
+ eend $? "Failed to stop webfsd" |
141 |
+} |
142 |
|
143 |
diff --git a/www-servers/webfs/files/webfs.service b/www-servers/webfs/files/webfs.service |
144 |
new file mode 100644 |
145 |
index 000000000000..f8857655e28f |
146 |
--- /dev/null |
147 |
+++ b/www-servers/webfs/files/webfs.service |
148 |
@@ -0,0 +1,10 @@ |
149 |
+[Unit] |
150 |
+Description=Simple and instant http server. |
151 |
+Documentation=man:webfsd(1) |
152 |
+After=network.target |
153 |
+ |
154 |
+[Service] |
155 |
+ExecStart=/usr/bin/webfsd -p ${WEBFS_PORT:-80} -f ${WEBFS_INDEX:-index.html} ${WEBFS_OPTS} -F |
156 |
+ |
157 |
+[Install] |
158 |
+WantedBy=multi-user.target |
159 |
|
160 |
diff --git a/www-servers/webfs/files/webfs.service.conf b/www-servers/webfs/files/webfs.service.conf |
161 |
new file mode 100644 |
162 |
index 000000000000..80daa14dc7ae |
163 |
--- /dev/null |
164 |
+++ b/www-servers/webfs/files/webfs.service.conf |
165 |
@@ -0,0 +1,27 @@ |
166 |
+# Configuration for webfsd |
167 |
+ |
168 |
+WEBFS_PORT=80 |
169 |
+WEBFS_DOCROOT=/var/www/localhost/htdocs |
170 |
+WEBFS_INDEX=index.html |
171 |
+WEBFS_LOG=/var/log/webfsd.log |
172 |
+ |
173 |
+# set server name |
174 |
+#WEBFS_SERVNAME= |
175 |
+ |
176 |
+# uncomment to chroot to specified dir |
177 |
+#WEBFS_CHROOT="/var/www/localhost" |
178 |
+ |
179 |
+# max allowed connections (defaults to 32) |
180 |
+#WEBFS_MAXCONN=50 |
181 |
+ |
182 |
+# uncomment to enable directory listings |
183 |
+#WEBFS_DIR_LIST=true |
184 |
+ |
185 |
+# uncomment to enable SSL (you'll need to add -C <cert> -P <pass> to WEBFS_OPTS) |
186 |
+#WEBFS_SSL=true |
187 |
+ |
188 |
+# uncomment to enable ipv6 |
189 |
+#WEBFS_IPV6=true |
190 |
+ |
191 |
+# Add any extra options here. See webfsd for more information. |
192 |
+#WEBFS_OPTS="" |
193 |
|
194 |
diff --git a/www-servers/webfs/metadata.xml b/www-servers/webfs/metadata.xml |
195 |
new file mode 100644 |
196 |
index 000000000000..34f42ecf020c |
197 |
--- /dev/null |
198 |
+++ b/www-servers/webfs/metadata.xml |
199 |
@@ -0,0 +1,8 @@ |
200 |
+<?xml version="1.0" encoding="UTF-8"?> |
201 |
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> |
202 |
+<pkgmetadata> |
203 |
+ <maintainer type="person"> |
204 |
+ <email>alexxy@g.o</email> |
205 |
+ <name>Alexey Shvetsov</name> |
206 |
+ </maintainer> |
207 |
+</pkgmetadata> |
208 |
|
209 |
diff --git a/www-servers/webfs/webfs-1.21.ebuild b/www-servers/webfs/webfs-1.21.ebuild |
210 |
new file mode 100644 |
211 |
index 000000000000..7b512f519cdf |
212 |
--- /dev/null |
213 |
+++ b/www-servers/webfs/webfs-1.21.ebuild |
214 |
@@ -0,0 +1,55 @@ |
215 |
+# Copyright 1999-2022 Gentoo Authors |
216 |
+# Distributed under the terms of the GNU General Public License v2 |
217 |
+ |
218 |
+EAPI=8 |
219 |
+ |
220 |
+inherit systemd |
221 |
+ |
222 |
+DESCRIPTION="Lightweight HTTP server for static content" |
223 |
+SRC_URI="http://dl.bytesex.org/releases/${PN}/${P}.tar.gz" |
224 |
+HOMEPAGE="http://linux.bytesex.org/misc/webfs.html" |
225 |
+ |
226 |
+LICENSE="GPL-2" |
227 |
+SLOT="0" |
228 |
+KEYWORDS="~amd64 ~x86" |
229 |
+IUSE="ssl threads" |
230 |
+ |
231 |
+DEPEND="ssl? ( dev-libs/openssl:0= )" |
232 |
+ |
233 |
+RDEPEND="${DEPEND} |
234 |
+ app-misc/mime-types" |
235 |
+ |
236 |
+PATCHES=( |
237 |
+ "${FILESDIR}/${P}-Variables.mk-dont-strip-binaries-on-install.patch" |
238 |
+ "${FILESDIR}/${P}-CVE-2013-0347.patch" |
239 |
+) |
240 |
+ |
241 |
+src_prepare() { |
242 |
+ sed -e "s:/etc/mime.types:${EPREFIX}\\0:" -i GNUmakefile || die "sed failed" |
243 |
+ default |
244 |
+} |
245 |
+ |
246 |
+src_compile() { |
247 |
+ local myconf |
248 |
+ use ssl || myconf="${myconf} USE_SSL=no" |
249 |
+ use threads && myconf="${myconf} USE_THREADS=yes" |
250 |
+ |
251 |
+ emake prefix="${EPREFIX}/usr" ${myconf} |
252 |
+} |
253 |
+ |
254 |
+src_install() { |
255 |
+ local myconf |
256 |
+ use ssl || myconf="${myconf} USE_SSL=no" |
257 |
+ use threads && myconf="${myconf} USE_THREADS=yes" |
258 |
+ emake DESTDIR="${D}" install prefix="${EPREFIX}/usr" ${myconf} mandir="${ED}/usr/share/man" |
259 |
+ newinitd "${FILESDIR}"/${PN}.initd ${PN} |
260 |
+ newconfd "${FILESDIR}"/${PN}.confd ${PN} |
261 |
+ systemd_dounit "${FILESDIR}/${PN}.service" |
262 |
+ systemd_install_serviced "${FILESDIR}/${PN}.service.conf" |
263 |
+ dodoc README |
264 |
+} |
265 |
+ |
266 |
+pkg_preinst() { |
267 |
+ # Fix existing log permissions for bug #458892. |
268 |
+ chmod 0600 "${EROOT}/var/log/webfsd.log" 2>/dev/null |
269 |
+} |