summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-02-19 22:33:06 +0000
committerSam James <sam@gentoo.org>2022-02-19 22:37:36 +0000
commit56a649b1ba943cfa82538fdc9eeb40164d8346eb (patch)
tree7e1223379a0a109a72e8e74d295698623f74aebe /net-irc
parentsci-libs/scotch: add 7.0.1 (diff)
downloadgentoo-56a649b1ba943cfa82538fdc9eeb40164d8346eb.tar.gz
gentoo-56a649b1ba943cfa82538fdc9eeb40164d8346eb.tar.bz2
gentoo-56a649b1ba943cfa82538fdc9eeb40164d8346eb.zip
net-irc/ergo: update EAPI 7 -> 8; init script fixes
- Mostly init script fixes: -- Add logging to init script -- Add delay so OpenRC realises if we crashed quickly b/c of e.g. bad config file -- General cleanups (like supporting multiple instances, style changes) - Enable tests (yay! the needed files are included in tarballs now) - Drop obsolete BDEPEND (go-module lower bound is higher) - Drop obsolete src_compile arg to go (default in min Go in eclass) - EAPI 8 Bug: https://github.com/ergochat/ergo/issues/1914 Thanks-to: Douglas Freed <dwfreed@mtu.edu> Thanks-to: William Hubbs <williamh@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-irc')
-rw-r--r--net-irc/ergo/ergo-2.9.1-r1.ebuild69
-rw-r--r--net-irc/ergo/files/ergo.confd-r13
-rw-r--r--net-irc/ergo/files/ergo.initd-r132
3 files changed, 104 insertions, 0 deletions
diff --git a/net-irc/ergo/ergo-2.9.1-r1.ebuild b/net-irc/ergo/ergo-2.9.1-r1.ebuild
new file mode 100644
index 000000000000..a836c2571de1
--- /dev/null
+++ b/net-irc/ergo/ergo-2.9.1-r1.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit go-module systemd
+
+DESCRIPTION="A modern IRC server written in Go"
+HOMEPAGE="https://ergo.chat/ https://github.com/ergochat/ergo"
+SRC_URI="https://github.com/ergochat/ergo/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="Apache-2.0 BSD-2 BSD ISC MIT MPL-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+
+# We may even want to package irctest in future?
+
+RDEPEND="acct-user/oragono
+ acct-group/oragono"
+
+DOCS=( README.md docs/MANUAL.md docs/USERGUIDE.md )
+
+src_prepare() {
+ default
+
+ # Minor fiddling with paths
+ sed -i \
+ -e 's:/home/ergo/ergo:/usr/bin/ergo:' \
+ -e 's:/home/ergo:/var/lib/ergo:' \
+ -e 's:/var/lib/ergo/ircd.yaml:/etc/ergo/ircd.yaml:' \
+ -e 's:User=ergo:User=oragono:' \
+ distrib/systemd/ergo.service || die
+}
+
+src_compile() {
+ go build . || die
+}
+
+src_install() {
+ einstalldocs
+
+ dobin ergo
+
+ insinto /etc/ergo
+ doins default.yaml
+
+ # Swap back in next release?
+ # Forked locally for https://github.com/ergochat/ergo/issues/1914 changes
+ #newinitd distrib/openrc/ergo.initd ergo
+ #newconfd distrib/openrc/ergo.confd ergo
+
+ newinitd "${FILESDIR}"/ergo.initd-r1 ergo
+ newconfd "${FILESDIR}"/ergo.confd-r1 ergo
+
+ keepdir /var/lib/ergo
+ fowners oragono:oragono /var/lib/ergo
+
+ insinto /var/lib/ergo
+ doins -r languages/
+
+ systemd_dounit distrib/systemd/ergo.service
+}
+
+pkg_postinst() {
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then
+ elog "Please copy the example config in ${EROOT}/etc/ergo:"
+ elog "e.g. cp ${EROOT}/etc/ergo/default.yaml ${EROOT}/etc/ergo/ircd.yaml"
+ fi
+}
diff --git a/net-irc/ergo/files/ergo.confd-r1 b/net-irc/ergo/files/ergo.confd-r1
new file mode 100644
index 000000000000..71f4585060e5
--- /dev/null
+++ b/net-irc/ergo/files/ergo.confd-r1
@@ -0,0 +1,3 @@
+# /etc/conf.d/ergo: config file for /etc/init.d/ergo
+ERGO_CONFIGFILE="/etc/ergo/ircd.yaml"
+ERGO_USERNAME="oragono"
diff --git a/net-irc/ergo/files/ergo.initd-r1 b/net-irc/ergo/files/ergo.initd-r1
new file mode 100644
index 000000000000..8bd1aba2b230
--- /dev/null
+++ b/net-irc/ergo/files/ergo.initd-r1
@@ -0,0 +1,32 @@
+#!/sbin/openrc-run
+name=${RC_SVCNAME}
+description="ergo IRC daemon"
+
+command=/usr/bin/ergo
+command_args="run --conf ${ERGO_CONFIGFILE:-'/etc/ergo/ircd.yaml'}"
+command_user=${ERGO_USERNAME:-ergo}
+command_background=true
+
+pidfile=/var/run/${RC_SVCNAME}.pid
+
+output_log="/var/log/${RC_SVCNAME}.out"
+error_log="/var/log/${RC_SVCNAME}.err"
+# --wait: to wait 1 second after launching to see if it survived startup
+start_stop_daemon_args="--wait 1000"
+
+extra_started_commands="reload"
+
+depend() {
+ use dns
+ provide ircd
+}
+
+start_pre() {
+ checkpath --owner ${command_user}:${command_user} --mode 0640 --file /var/log/${RC_SVCNAME}.out /var/log/${RC_SVCNAME}.err
+}
+
+reload() {
+ ebegin "Reloading ${RC_SVCNAME}"
+ start-stop-daemon --signal HUP --pidfile "${pidfile}"
+ eend $?
+}