1 |
commit: 03f7fc88d9fd3fa086db52056a66014ef16fb1d4 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Dec 31 07:51:06 2021 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jan 3 07:40:48 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03f7fc88 |
7 |
|
8 |
net-irc/unrealircd: add 5.2.3 |
9 |
|
10 |
- Add 5.2.3 |
11 |
- Add chroot support to init script |
12 |
- Add checkconfig support to init script |
13 |
|
14 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
15 |
|
16 |
net-irc/unrealircd/Manifest | 1 + |
17 |
net-irc/unrealircd/files/unrealircd.confd-r4 | 37 ++++++ |
18 |
net-irc/unrealircd/files/unrealircd.initd-r3 | 62 ++++++++++ |
19 |
net-irc/unrealircd/unrealircd-5.2.3.ebuild | 175 +++++++++++++++++++++++++++ |
20 |
4 files changed, 275 insertions(+) |
21 |
|
22 |
diff --git a/net-irc/unrealircd/Manifest b/net-irc/unrealircd/Manifest |
23 |
index 5e1d7316cb20..b604a53bfb0f 100644 |
24 |
--- a/net-irc/unrealircd/Manifest |
25 |
+++ b/net-irc/unrealircd/Manifest |
26 |
@@ -1 +1,2 @@ |
27 |
DIST unrealircd-5.2.2.tar.gz 7192024 BLAKE2B aa700c943cbab1dcc751e32c6cc0608cd27936b0910bbc62987dd2fe87ee5261e7a5eb2aa67dd77ed5ecb39d1d4f149c8810159e2c6f752ee65ce34e46548f60 SHA512 9d36eb1567431bc4a5420bc830bfc8dc89daa08ed1746efd6102e5ef161f67baf52e75e373454df7df6a443c4f575fb300d3c289d4dd99239a6de7d2b2a555a0 |
28 |
+DIST unrealircd-5.2.3.tar.gz 7200834 BLAKE2B af15b97219d5552a8fe6ecd77b4d0d0b8bcbe8c2f65ab531a7322471c05af3001000cc3799db68291b9abe8c3a5ea7d04559f858774d1b12a764a20fb4ab2bd0 SHA512 c92c631340cb81b030006646a047fde4ee738edc8362870ba4eb979133d851806c7d4764848a35cbd48c787708eab9f051f257008798a494673d9986d16b2405 |
29 |
|
30 |
diff --git a/net-irc/unrealircd/files/unrealircd.confd-r4 b/net-irc/unrealircd/files/unrealircd.confd-r4 |
31 |
new file mode 100644 |
32 |
index 000000000000..934ac0e3f59f |
33 |
--- /dev/null |
34 |
+++ b/net-irc/unrealircd/files/unrealircd.confd-r4 |
35 |
@@ -0,0 +1,37 @@ |
36 |
+# Copyright 1999-2021 Gentoo Authors |
37 |
+# Distributed under the terms of the GNU General Public License v2 |
38 |
+ |
39 |
+# Where to chroot to |
40 |
+# Uncomment this line for chrooting |
41 |
+#UNREALIRCD_CHROOT="/var/chroot/ircd" |
42 |
+UNREALIRCD_CHROOT="" |
43 |
+ |
44 |
+# Which configuration file to load instead of unrealircd.conf. If you |
45 |
+# want to run multiple instances of unrealircd, you must edit |
46 |
+# files::pidfile to match UNREALIRCD_PIDFILE. You should also ensure |
47 |
+# that files::tunefile is different for each unrealircd instance. See |
48 |
+# https://www.unrealircd.org/docs/Configuration#Files_block |
49 |
+# |
50 |
+# To support multiple instances of unrealircd, you may create symlinks |
51 |
+# in /etc/init.d pointing to /etc/init.d/unrealircd. It is recommended |
52 |
+# that the scheme unrealircd.${instance_name} be used. For each |
53 |
+# instance, you may make a copy of this file with the appropriate name |
54 |
+# to override default options specific to that instance. |
55 |
+UNREALIRCD_CONF="${UNREALIRCD_CHROOT}/etc/unrealircd/${SVCNAME}.conf" |
56 |
+ |
57 |
+# The path where unrealircd is configured to create its pidfile. |
58 |
+UNREALIRCD_PIDFILE="${UNREALIRCD_CHROOT}/run/unrealircd/${SVCNAME#unreal}.pid" |
59 |
+ |
60 |
+# extra options to pass to unrealircd ... |
61 |
+# You should not specify the -f option here; use |
62 |
+# UNREALIRCD_CONF instead. |
63 |
+# |
64 |
+# [-h servername] |
65 |
+# [-p portnumber] |
66 |
+# [-x loglevel] |
67 |
+# [-t] (to enable debug output) |
68 |
+UNREALIRCD_OPTS="" |
69 |
+ |
70 |
+# Extra flags to pass to start-stop-daemon. When initially |
71 |
+# debugging, removing --quiet may help. |
72 |
+UNREALIRCD_SSD_OPTS="--quiet" |
73 |
|
74 |
diff --git a/net-irc/unrealircd/files/unrealircd.initd-r3 b/net-irc/unrealircd/files/unrealircd.initd-r3 |
75 |
new file mode 100644 |
76 |
index 000000000000..d2ff1a64c969 |
77 |
--- /dev/null |
78 |
+++ b/net-irc/unrealircd/files/unrealircd.initd-r3 |
79 |
@@ -0,0 +1,62 @@ |
80 |
+#!/sbin/openrc-run |
81 |
+# Copyright 1999-2021 Gentoo Authors |
82 |
+# Distributed under the terms of the GNU General Public License v2 |
83 |
+ |
84 |
+# Defaults |
85 |
+: ${UNREALIRCD_CONF:=/etc/unrealircd/${SVCNAME}.conf} |
86 |
+: ${UNREALIRCD_PIDFILE:=/run/unrealircd/${SVCNAME#unreal}.pid} |
87 |
+ |
88 |
+# Convenience variable for the chroot bits, not actually user-controllable via conf.d |
89 |
+UNREALIRCD_USER="unrealircd" |
90 |
+UNREALIRCD_BIN="/usr/bin/unrealircd" |
91 |
+UNREALIRCD_COMMAND_ARGS="-F -f ${UNREALIRCD_CONF} ${UNREALIRCD_OPTS}" |
92 |
+ |
93 |
+# Run the daemon in the foreground and let OpenRC background it. |
94 |
+# This way the PID file is created securely, as root. |
95 |
+# https://bugs.unrealircd.org/view.php?id=4990 |
96 |
+# https://bugs.gentoo.org/628434 |
97 |
+command_args="${UNREALIRCD_COMMAND_ARGS}" |
98 |
+command_background=true |
99 |
+pidfile="${UNREALIRCD_PIDFILE}" |
100 |
+ |
101 |
+start_stop_daemon_args="${UNREALIRCD_SSD_OPTS}" |
102 |
+extra_started_commands="checkconfig reload" |
103 |
+ |
104 |
+if [ -n "${UNREALIRCD_CHROOT}" ]; then |
105 |
+ command=/usr/bin/chroot |
106 |
+ command_args="--userspec ${UNREALIRCD_USER}:${UNREALIRCD_USER} ${UNREALIRCD_CHROOT} ${UNREALIRCD_BIN} ${UNREALIRCD_COMMAND_ARGS}" |
107 |
+else |
108 |
+ # We're running it directly so no need for anything special. |
109 |
+ command="${UNREALIRCD_BIN}" |
110 |
+ command_user=${UNREALIRCD_USER} |
111 |
+fi |
112 |
+ |
113 |
+checkconfig() { |
114 |
+ # command_args weirdness because We want to preserve the chroot arguments if it's set |
115 |
+ su -s /bin/sh ${command_user:=root} -c "${command} ${command_args%${UNREALIRCD_COMMAND_ARGS}}" configtest |
116 |
+} |
117 |
+ |
118 |
+depend() { |
119 |
+ use dns net |
120 |
+ provide ircd |
121 |
+} |
122 |
+ |
123 |
+# It is unsafe for the unrealircd user to be able to write to its own |
124 |
+# PID file, since root will be sending e.g. kill signals to the PID |
125 |
+# listed in that file. Ensure that we overwrite the ownership and |
126 |
+# permissions on /run/unrealircd from previous init scripts. |
127 |
+start_pre() { |
128 |
+ checkpath --directory --owner root:root --mode 0700 "${UNREALIRCD_CHROOT}"/run/unrealircd |
129 |
+ |
130 |
+ checkconfig || return $? |
131 |
+} |
132 |
+ |
133 |
+reload() { |
134 |
+ checkconfig || return $? |
135 |
+ |
136 |
+ ebegin "Reloading ${RC_SVCNAME}" |
137 |
+ start-stop-daemon --signal HUP \ |
138 |
+ --pidfile "${pidfile}" \ |
139 |
+ ${UNREALIRCD_SSD_OPTS} |
140 |
+ eend $? |
141 |
+} |
142 |
|
143 |
diff --git a/net-irc/unrealircd/unrealircd-5.2.3.ebuild b/net-irc/unrealircd/unrealircd-5.2.3.ebuild |
144 |
new file mode 100644 |
145 |
index 000000000000..cf63b49a2637 |
146 |
--- /dev/null |
147 |
+++ b/net-irc/unrealircd/unrealircd-5.2.3.ebuild |
148 |
@@ -0,0 +1,175 @@ |
149 |
+# Copyright 1999-2021 Gentoo Authors |
150 |
+# Distributed under the terms of the GNU General Public License v2 |
151 |
+ |
152 |
+EAPI=7 |
153 |
+ |
154 |
+SSL_CERT_MANDATORY=1 |
155 |
+inherit autotools ssl-cert systemd |
156 |
+ |
157 |
+DESCRIPTION="An advanced Internet Relay Chat daemon" |
158 |
+HOMEPAGE="https://www.unrealircd.org/" |
159 |
+SRC_URI="https://www.unrealircd.org/downloads/${P}.tar.gz" |
160 |
+ |
161 |
+LICENSE="GPL-2" |
162 |
+SLOT="0" |
163 |
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux" |
164 |
+IUSE="class-nofakelag curl +operoverride operoverride-verify +prefixaq showlistmodes" |
165 |
+ |
166 |
+RDEPEND="acct-group/unrealircd |
167 |
+ acct-user/unrealircd |
168 |
+ >=app-crypt/argon2-20171227-r1:= |
169 |
+ dev-libs/libpcre2 |
170 |
+ dev-libs/libsodium:= |
171 |
+ dev-libs/openssl:0= |
172 |
+ >=net-dns/c-ares-1.7:= |
173 |
+ virtual/libcrypt:= |
174 |
+ curl? ( net-misc/curl[adns] )" |
175 |
+DEPEND="${RDEPEND}" |
176 |
+BDEPEND="virtual/pkgconfig" |
177 |
+ |
178 |
+DOCS=( doc/{Authors,Donation,RELEASE-NOTES.md,tao.of.irc,technical/,translations.txt} ) |
179 |
+ |
180 |
+src_prepare() { |
181 |
+ # QA check against bundled pkgs |
182 |
+ rm -r extras || die |
183 |
+ |
184 |
+ # building third-party modules (which we don't do) cause a sandbox violation |
185 |
+ # bug 704444 |
186 |
+ echo "" > src/buildmod || die |
187 |
+ |
188 |
+ sed -e 's/$(MODULEFLAGS)/$(LDFLAGS) &/' -i src/modules/{,*/}Makefile.in || die |
189 |
+ |
190 |
+ if use class-nofakelag; then |
191 |
+ sed -i -e 's:^//#undef\( FAKELAG_CONFIGURABLE\):#define\1:' include/config.h || die |
192 |
+ fi |
193 |
+ |
194 |
+ # File is missing from the 5.0.9.1 tarball |
195 |
+ sed -i -e '/unrealircd-upgrade-script/d' configure.ac || die |
196 |
+ |
197 |
+ default |
198 |
+ eautoreconf |
199 |
+} |
200 |
+ |
201 |
+src_configure() { |
202 |
+ # Default value for privatelibdir adds a build path to -Wl,-rpath. |
203 |
+ econf \ |
204 |
+ --with-bindir="${EPREFIX}"/usr/bin \ |
205 |
+ --with-cachedir="${EPREFIX}"/var/lib/${PN} \ |
206 |
+ --with-confdir="${EPREFIX}"/etc/${PN} \ |
207 |
+ --with-datadir="${EPREFIX}"/var/lib/${PN} \ |
208 |
+ --with-docdir="${EPREFIX}"/usr/share/doc/${PF} \ |
209 |
+ --with-logdir="${EPREFIX}"/var/log/${PN} \ |
210 |
+ --with-modulesdir="${EPREFIX}/usr/$(get_libdir)"/${PN}/modules \ |
211 |
+ --without-privatelibdir \ |
212 |
+ --with-pidfile="${EPREFIX}"/run/${PN}/ircd.pid \ |
213 |
+ --with-tmpdir="${EPREFIX}"/var/lib/${PN}/tmp \ |
214 |
+ --with-maxconnections=1024 \ |
215 |
+ --with-nick-history=2000 \ |
216 |
+ --with-permissions=0640 \ |
217 |
+ --with-system-argon2 \ |
218 |
+ --with-system-cares \ |
219 |
+ --with-system-pcre2 \ |
220 |
+ --enable-dynamic-linking \ |
221 |
+ --enable-ssl="${EPREFIX}"/usr \ |
222 |
+ $(use_enable curl libcurl "${EPREFIX}"/usr) \ |
223 |
+ $(use_enable prefixaq) \ |
224 |
+ $(use_with showlistmodes) \ |
225 |
+ $(use_with !operoverride no-operoverride) \ |
226 |
+ $(use_with operoverride-verify) |
227 |
+} |
228 |
+ |
229 |
+src_install() { |
230 |
+ keepdir /var/log/${PN} |
231 |
+ keepdir /var/lib/${PN}/tmp |
232 |
+ |
233 |
+ newbin src/ircd ${PN} |
234 |
+ |
235 |
+ ( |
236 |
+ cd src/modules || die |
237 |
+ for subdir in $(find . -type d -print); do |
238 |
+ if [[ -n $(shopt -s nullglob; echo ${subdir}/*.so) ]]; then |
239 |
+ exeinto /usr/$(get_libdir)/${PN}/modules/"${subdir}" |
240 |
+ doexe "${subdir}"/*.so |
241 |
+ fi |
242 |
+ done |
243 |
+ ) |
244 |
+ |
245 |
+ insinto /etc/${PN} |
246 |
+ # Purposefully omitting the examples/ and ssl/ subdirectories. ssl |
247 |
+ # is redundant with app-misc/ca-certificates and examples will all |
248 |
+ # be in docs anyway. |
249 |
+ doins -r doc/conf/{aliases,help} |
250 |
+ doins doc/conf/*.conf |
251 |
+ newins doc/conf/examples/example.conf ${PN}.conf |
252 |
+ keepdir /etc/${PN}/tls |
253 |
+ |
254 |
+ einstalldocs |
255 |
+ |
256 |
+ newinitd "${FILESDIR}"/${PN}.initd-r3 ${PN} |
257 |
+ newconfd "${FILESDIR}"/${PN}.confd-r4 ${PN} |
258 |
+ |
259 |
+ # config should be read-only |
260 |
+ fperms -R 0640 /etc/${PN} |
261 |
+ fperms 0750 /etc/${PN}{,/aliases,/help} |
262 |
+ fperms 0750 /etc/${PN}/tls |
263 |
+ # state is editable but not owned by unrealircd directly |
264 |
+ fperms 0770 /var/log/${PN} |
265 |
+ fperms 0770 /var/lib/${PN}{,/tmp} |
266 |
+ fowners -R root:unrealircd /{etc,var/{lib,log}}/${PN} |
267 |
+ |
268 |
+ # By default looks in /etc/unrealircd/ssl/curl-ca-bundle.crt. Fix |
269 |
+ # that to look for ca-certificates-provided file instead. %s is |
270 |
+ # CONFDIR. #618066 |
271 |
+ dosym ../../ssl/certs/ca-certificates.crt /etc/${PN}/tls/curl-ca-bundle.crt |
272 |
+ |
273 |
+ systemd_dounit "${FILESDIR}"/${PN}.service |
274 |
+} |
275 |
+ |
276 |
+pkg_postinst() { |
277 |
+ # Move docert call from src_install() to install_cert in pkg_postinst for |
278 |
+ # bug #201682 |
279 |
+ if [[ ! -f "${EROOT}"/etc/${PN}/tls/server.cert.key ]]; then |
280 |
+ if [[ -f "${EROOT}"/etc/${PN}/ssl/server.cert.key ]]; then |
281 |
+ ewarn "The location ${PN} looks for SSL certificates has changed" |
282 |
+ ewarn "from ${EROOT}/etc/${PN}/ssl to ${EROOT}/etc/${PN}/tls." |
283 |
+ ewarn "Please move your existing certificates." |
284 |
+ else |
285 |
+ ( |
286 |
+ umask 0037 |
287 |
+ install_cert /etc/${PN}/tls/server.cert |
288 |
+ chown unrealircd "${EROOT}"/etc/${PN}/tls/server.cert.* |
289 |
+ ln -snf server.cert.key "${EROOT}"/etc/${PN}/tls/server.key.pem |
290 |
+ ) |
291 |
+ fi |
292 |
+ fi |
293 |
+ |
294 |
+ local unrealircd_conf="${EROOT}"/etc/${PN}/${PN}.conf |
295 |
+ # Fix up the default cloak keys. |
296 |
+ if grep -qe '"and another one";$' "${unrealircd_conf}" && grep -qe '"aoAr1HnR6gl3sJ7hVz4Zb7x4YwpW";$' "${unrealircd_conf}"; then |
297 |
+ ebegin "Generating cloak-keys" |
298 |
+ local keys=( |
299 |
+ $(su ${PN} -s /bin/sh -c "${PN} -k 2>&1 | tail -n 3") |
300 |
+ ) |
301 |
+ [[ -n ${keys[0]} || -n ${keys[1]} || -n ${keys[2]} ]] |
302 |
+ eend $? |
303 |
+ |
304 |
+ ebegin "Substituting cloak-keys into ${unrealircd_conf}" |
305 |
+ sed -i \ |
306 |
+ -e '/cloak-keys/ { |
307 |
+n |
308 |
+s/"aoAr1HnR6gl3sJ7hVz4Zb7x4YwpW";/"'"${keys[0]}"'";/ |
309 |
+n |
310 |
+s/"and another one";/"'"${keys[1]}"'";/ |
311 |
+n |
312 |
+s/"and another one";/"'"${keys[2]}"'";/ |
313 |
+}' \ |
314 |
+ "${unrealircd_conf}" |
315 |
+ eend $? |
316 |
+ fi |
317 |
+ |
318 |
+ elog "UnrealIRCd will not run until you've set up ${EROOT}/etc/unrealircd/unrealircd.conf" |
319 |
+ elog |
320 |
+ elog "You can also configure ${PN} start at boot with rc-update(1)." |
321 |
+ elog "It is recommended to run unrealircd as an unprivileged user." |
322 |
+ elog "The provided init.d script does this for you." |
323 |
+} |