1 |
commit: 56a649b1ba943cfa82538fdc9eeb40164d8346eb |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Feb 19 22:33:06 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Feb 19 22:37:36 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=56a649b1 |
7 |
|
8 |
net-irc/ergo: update EAPI 7 -> 8; init script fixes |
9 |
|
10 |
- Mostly init script fixes: |
11 |
-- Add logging to init script |
12 |
-- Add delay so OpenRC realises if we crashed quickly b/c of e.g. bad config |
13 |
file |
14 |
-- General cleanups (like supporting multiple instances, style changes) |
15 |
|
16 |
- Enable tests (yay! the needed files are included in tarballs now) |
17 |
- Drop obsolete BDEPEND (go-module lower bound is higher) |
18 |
- Drop obsolete src_compile arg to go (default in min Go in eclass) |
19 |
- EAPI 8 |
20 |
|
21 |
Bug: https://github.com/ergochat/ergo/issues/1914 |
22 |
Thanks-to: Douglas Freed <dwfreed <AT> mtu.edu> |
23 |
Thanks-to: William Hubbs <williamh <AT> gentoo.org> |
24 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
25 |
|
26 |
net-irc/ergo/ergo-2.9.1-r1.ebuild | 69 +++++++++++++++++++++++++++++++++++++++ |
27 |
net-irc/ergo/files/ergo.confd-r1 | 3 ++ |
28 |
net-irc/ergo/files/ergo.initd-r1 | 32 ++++++++++++++++++ |
29 |
3 files changed, 104 insertions(+) |
30 |
|
31 |
diff --git a/net-irc/ergo/ergo-2.9.1-r1.ebuild b/net-irc/ergo/ergo-2.9.1-r1.ebuild |
32 |
new file mode 100644 |
33 |
index 000000000000..a836c2571de1 |
34 |
--- /dev/null |
35 |
+++ b/net-irc/ergo/ergo-2.9.1-r1.ebuild |
36 |
@@ -0,0 +1,69 @@ |
37 |
+# Copyright 1999-2022 Gentoo Authors |
38 |
+# Distributed under the terms of the GNU General Public License v2 |
39 |
+ |
40 |
+EAPI=8 |
41 |
+ |
42 |
+inherit go-module systemd |
43 |
+ |
44 |
+DESCRIPTION="A modern IRC server written in Go" |
45 |
+HOMEPAGE="https://ergo.chat/ https://github.com/ergochat/ergo" |
46 |
+SRC_URI="https://github.com/ergochat/ergo/archive/v${PV}.tar.gz -> ${P}.tar.gz" |
47 |
+ |
48 |
+LICENSE="Apache-2.0 BSD-2 BSD ISC MIT MPL-2.0" |
49 |
+SLOT="0" |
50 |
+KEYWORDS="~amd64" |
51 |
+ |
52 |
+# We may even want to package irctest in future? |
53 |
+ |
54 |
+RDEPEND="acct-user/oragono |
55 |
+ acct-group/oragono" |
56 |
+ |
57 |
+DOCS=( README.md docs/MANUAL.md docs/USERGUIDE.md ) |
58 |
+ |
59 |
+src_prepare() { |
60 |
+ default |
61 |
+ |
62 |
+ # Minor fiddling with paths |
63 |
+ sed -i \ |
64 |
+ -e 's:/home/ergo/ergo:/usr/bin/ergo:' \ |
65 |
+ -e 's:/home/ergo:/var/lib/ergo:' \ |
66 |
+ -e 's:/var/lib/ergo/ircd.yaml:/etc/ergo/ircd.yaml:' \ |
67 |
+ -e 's:User=ergo:User=oragono:' \ |
68 |
+ distrib/systemd/ergo.service || die |
69 |
+} |
70 |
+ |
71 |
+src_compile() { |
72 |
+ go build . || die |
73 |
+} |
74 |
+ |
75 |
+src_install() { |
76 |
+ einstalldocs |
77 |
+ |
78 |
+ dobin ergo |
79 |
+ |
80 |
+ insinto /etc/ergo |
81 |
+ doins default.yaml |
82 |
+ |
83 |
+ # Swap back in next release? |
84 |
+ # Forked locally for https://github.com/ergochat/ergo/issues/1914 changes |
85 |
+ #newinitd distrib/openrc/ergo.initd ergo |
86 |
+ #newconfd distrib/openrc/ergo.confd ergo |
87 |
+ |
88 |
+ newinitd "${FILESDIR}"/ergo.initd-r1 ergo |
89 |
+ newconfd "${FILESDIR}"/ergo.confd-r1 ergo |
90 |
+ |
91 |
+ keepdir /var/lib/ergo |
92 |
+ fowners oragono:oragono /var/lib/ergo |
93 |
+ |
94 |
+ insinto /var/lib/ergo |
95 |
+ doins -r languages/ |
96 |
+ |
97 |
+ systemd_dounit distrib/systemd/ergo.service |
98 |
+} |
99 |
+ |
100 |
+pkg_postinst() { |
101 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
102 |
+ elog "Please copy the example config in ${EROOT}/etc/ergo:" |
103 |
+ elog "e.g. cp ${EROOT}/etc/ergo/default.yaml ${EROOT}/etc/ergo/ircd.yaml" |
104 |
+ fi |
105 |
+} |
106 |
|
107 |
diff --git a/net-irc/ergo/files/ergo.confd-r1 b/net-irc/ergo/files/ergo.confd-r1 |
108 |
new file mode 100644 |
109 |
index 000000000000..71f4585060e5 |
110 |
--- /dev/null |
111 |
+++ b/net-irc/ergo/files/ergo.confd-r1 |
112 |
@@ -0,0 +1,3 @@ |
113 |
+# /etc/conf.d/ergo: config file for /etc/init.d/ergo |
114 |
+ERGO_CONFIGFILE="/etc/ergo/ircd.yaml" |
115 |
+ERGO_USERNAME="oragono" |
116 |
|
117 |
diff --git a/net-irc/ergo/files/ergo.initd-r1 b/net-irc/ergo/files/ergo.initd-r1 |
118 |
new file mode 100644 |
119 |
index 000000000000..8bd1aba2b230 |
120 |
--- /dev/null |
121 |
+++ b/net-irc/ergo/files/ergo.initd-r1 |
122 |
@@ -0,0 +1,32 @@ |
123 |
+#!/sbin/openrc-run |
124 |
+name=${RC_SVCNAME} |
125 |
+description="ergo IRC daemon" |
126 |
+ |
127 |
+command=/usr/bin/ergo |
128 |
+command_args="run --conf ${ERGO_CONFIGFILE:-'/etc/ergo/ircd.yaml'}" |
129 |
+command_user=${ERGO_USERNAME:-ergo} |
130 |
+command_background=true |
131 |
+ |
132 |
+pidfile=/var/run/${RC_SVCNAME}.pid |
133 |
+ |
134 |
+output_log="/var/log/${RC_SVCNAME}.out" |
135 |
+error_log="/var/log/${RC_SVCNAME}.err" |
136 |
+# --wait: to wait 1 second after launching to see if it survived startup |
137 |
+start_stop_daemon_args="--wait 1000" |
138 |
+ |
139 |
+extra_started_commands="reload" |
140 |
+ |
141 |
+depend() { |
142 |
+ use dns |
143 |
+ provide ircd |
144 |
+} |
145 |
+ |
146 |
+start_pre() { |
147 |
+ checkpath --owner ${command_user}:${command_user} --mode 0640 --file /var/log/${RC_SVCNAME}.out /var/log/${RC_SVCNAME}.err |
148 |
+} |
149 |
+ |
150 |
+reload() { |
151 |
+ ebegin "Reloading ${RC_SVCNAME}" |
152 |
+ start-stop-daemon --signal HUP --pidfile "${pidfile}" |
153 |
+ eend $? |
154 |
+} |