Subject: [PATCH] main/charybdis: fix initscript & localstatedir location

From: opal hart <[email-masked]>
Date: Mon, 24 Feb 2020 06:37:28 +0000

rewrite initscript because it was pointing to the wrong executable, and
the declarative syntax is simpler to understand and maintain

for localstatedir: /var/charybdis didn't make sense, and the directory
was never created on package install, making it impossible to start
charybdis with default config without further intervention. move to
/var/lib/charybdis and actually create that directory for the user
---
 main/charybdis/APKBUILD        | 13 ++++++-------
 main/charybdis/charybdis.initd | 23 +++++------------------
 2 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/main/charybdis/APKBUILD b/main/charybdis/APKBUILD
index 1012d22b12..987b242da2 100644
--- a/main/charybdis/APKBUILD
+++ b/main/charybdis/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Francesco Colista <[email-masked]>
 pkgname=charybdis
 pkgver=4.1.2
-pkgrel=1
+pkgrel=2
 pkgdesc="A highly-scalable IRCv3-compliant IRC daemon"
 url="https://github.com/charybdis-ircd/charybdis"
 arch="all"
@@ -30,7 +30,7 @@ build() {
 		--host=$CHOST \
 		--prefix=/usr \
 		--sysconfdir=/etc/charybdis \
-		--localstatedir=/var \
+		--localstatedir=/var/lib \
 		--libexecdir=/usr/lib \
 		--libdir=/usr/lib/charybdis \
 		--enable-epoll \
@@ -53,12 +53,11 @@ package() {
 	make -j1 DESTDIR="$pkgdir" install
 	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/charybdis-ircd
 	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/charybdis-ircd
-	mkdir -p "$pkgdir"/var/run/charybdis
-	mkdir -p "$pkgdir"/var/log/charybdis
-	chown ircd "$pkgdir"/var/run/charybdis
-	chown ircd "$pkgdir"/var/log/charybdis
+	install -d -o ircd "$pkgdir"/var/run/charybdis
+	install -d -o ircd "$pkgdir"/var/lib/charybdis
+	install -d -o ircd "$pkgdir"/var/log/charybdis
 }
 
 sha512sums="409d64f1e6660c667699013436f434e419c5a8fb49acc9db0f2f707d0aee55d93df58c81beb60fb736cf8bd64499a64519a32d15b384aa628801eb2f20620545  charybdis-4.1.2.tar.gz
-584d28ded8c943172764ee89a0dcf2593e8a71a9ce876635b6fb86485171caad7c5e7fe0ec18fc217bfe93b7ceb865e9930e3af74458cb1f0b698c38fd70947f  charybdis.initd
+7c5288f5a1f070a534ecfb306b233802515fff916411e7eb7837398f0f126f38b9338a046d5e4fc211f6f8328404b1f2db71aac2b8ef968173a700b09faa5f7a  charybdis.initd
 1886b312b0ea40945de45db7a379bff2a3af426155fb77676e03f21f8d1d733e057fb5c3cb65fb72bb56008c4c92f3d2d0010563f871fd0802446de443ddfd5e  charybdis.confd"
diff --git a/main/charybdis/charybdis.initd b/main/charybdis/charybdis.initd
index bbf614de9b..779d6425dc 100644
--- a/main/charybdis/charybdis.initd
+++ b/main/charybdis/charybdis.initd
@@ -1,22 +1,9 @@
 #!/sbin/openrc-run
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-irc/charybdis/files/charybdis-ircd.initd,v 1.2 2008/01/08 21:17:02 jokey Exp $
+
+command="/usr/bin/charybdis"
+command_user="${CHARYBDIS_USER:-ircd}"
 
 depend() {
- 	use net
- 	provide ircd
-}
-	
-start() {
- 	ebegin "Starting ircd-charybdis"
- 	start-stop-daemon --start --quiet -u ${CHARYBDIS_USER} --exec /usr/bin/charybdis-ircd -- -configfile ${CHARYBDIS_CONF}>/dev/null
- 	eend $?
+	use net
+	provide ircd
 }
- 	
-stop() {
- 	ebegin "Stopping ircd-charybdis"
- 	start-stop-daemon --stop --quiet --pidfile ${CHARYBDIS_PID}
- 	eend $?
-}
-
-- 
2.24.1