From ad8a8335f7ce54e422a0b48d4c5e00a8f4ff7efe Mon Sep 17 00:00:00 2001 From: Ayush Agarwal Date: Sun, 13 Aug 2023 11:41:26 +0530 Subject: [PATCH] testing/pounce: add install script, openrc files The pounce initscript has been configured for creating multiple instances of pounce because a single instance of pounce can connect to only one IRC network. The calico initscript and conf.d file is needed if pounce creates UNIX domain sockets. --- testing/pounce/APKBUILD | 13 +++++++++- testing/pounce/calico.confd | 20 +++++++++++++++ testing/pounce/calico.initd | 21 ++++++++++++++++ testing/pounce/pounce.confd | 11 +++++++++ testing/pounce/pounce.initd | 41 +++++++++++++++++++++++++++++++ testing/pounce/pounce.pre-install | 5 ++++ 6 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 testing/pounce/calico.confd create mode 100644 testing/pounce/calico.initd create mode 100644 testing/pounce/pounce.confd create mode 100644 testing/pounce/pounce.initd create mode 100644 testing/pounce/pounce.pre-install diff --git a/testing/pounce/APKBUILD b/testing/pounce/APKBUILD index 54dd48b27e9..b9ad76e98c7 100644 --- a/testing/pounce/APKBUILD +++ b/testing/pounce/APKBUILD @@ -1,14 +1,16 @@ +# Contributor: ayushnix # Contributor: TBK # Maintainer: TBK pkgname=pounce pkgver=3.1 -pkgrel=1 +pkgrel=2 pkgdesc="Multi-client, TLS-only IRC bouncer" arch="all" url="https://git.causal.agency/pounce/" license="GPL-3.0-or-later" options="!check" # No test suite makedepends="libretls-dev" +install="$pkgname.pre-install" subpackages="$pkgname-doc" source="https://git.causal.agency/pounce/snapshot/pounce-$pkgver.tar.gz" @@ -21,8 +23,17 @@ build() { package() { make DESTDIR="$pkgdir" install + install -Dm644 "$srcdir"/pounce.confd "$pkgdir"/etc/conf.d/pounce + install -Dm644 "$srcdir"/calico.confd "$pkgdir"/etc/conf.d/calico + install -Dm755 "$srcdir"/pounce.initd "$pkgdir"/etc/init.d/pounce + install -Dm755 "$srcdir"/calico.initd "$pkgdir"/etc/init.d/calico } sha512sums=" b2c2481e152368080e6ce9b3be2d7920eb4cac630dabb994e31170fb44977e2235c0ff30a7f08e826a329da69371a3ff2dae33831cb93b18655f98fc6569da7d pounce-3.1.tar.gz +fb668102389b4d7b58ba709b19aec9ff421fd8c41311ad8dff5aa704ee657304f2e06aa3589c809d02e2d74a241ad62f1b7f37854fa496c165ccd95aa4bafd50 pounce.confd +1bf9f4bc63689bce34b8ba15013bc7c85f883eb2ab530da65cdd5b746fef0450b0466ba4c3f7cc511acc2cf5ff0969305e9f3cf98c5c5f9688255ec9cf395690 pounce.initd +ad1a333be7d7d4bfa9f1931b7bee35df2a860960db929fce437f0d0d73fb858f2131d622254bb5a0b288efe075e0a63abc54125ecfb0bd2a6b9c668a3a92b65f calico.confd +9ad4d2b314e7ec33f353636cc57de0d609b472870cf500ddd6e222e458cbc3b93b221cc805df04b51ec41f80576e19c30b296671cea3eeab388af9a8ae6e5c5d calico.initd +c4082bd08ee0124a10ddce240de62b8ef6e5ae85e939e856af7758ac43ef8edca3fd6e219823d6259848b59589f3db51de6d73735e4d5fcadf8c7be05d49a7bf pounce.pre-install " diff --git a/testing/pounce/calico.confd b/testing/pounce/calico.confd new file mode 100644 index 00000000000..0bb6e0b2c4e --- /dev/null +++ b/testing/pounce/calico.confd @@ -0,0 +1,20 @@ +calico_user=pounce +calico_group=pounce + +# the $calico_dir directory should be accessible to the $calico_user and the +# $pounce_user in the respective pounce config file in /etc/conf.d/ +# the value of this variable should be equal to the value of the 'local-path' +# configuration option in pounce configuration file(s) +calico_dir=/run/pounce + +# the '-H' argument for calico +# the hostname on which calico will listen on +# calico_hostname=hostname.example.org + +# the '-P' argument for calico +# read calico(1) for more details +# calico_port= + +# the '-t' argument for calico +# read calico(1) for more details +# calico_timeout= diff --git a/testing/pounce/calico.initd b/testing/pounce/calico.initd new file mode 100644 index 00000000000..c2728cdc7fd --- /dev/null +++ b/testing/pounce/calico.initd @@ -0,0 +1,21 @@ +#!/sbin/openrc-run + +: "${calico_user:=pounce}" +: "${calico_group:=pounce}" +: "${calico_hostname:=localhost}" +: "${calico_dir:=/run/$calico_user}" + +name="calico" +description="dispatch incoming TLS connections to pounce by SNI" +command=/usr/bin/calico +command_args="-H $calico_hostname $calico_dir" +[ -n "$calico_port" ] && command_args="$command_args -P $calico_port" +[ -n "$calico_timeout" ] && command_args="$command_args -t $calico_timeout" +command_background=true +command_user="${calico_user}:${calico_group}" +pidfile="/run/${RC_SVCNAME}.pid" + +depend() { + need localmount net + use dns +} diff --git a/testing/pounce/pounce.confd b/testing/pounce/pounce.confd new file mode 100644 index 00000000000..724b73565b0 --- /dev/null +++ b/testing/pounce/pounce.confd @@ -0,0 +1,11 @@ +pounce_user=pounce +pounce_group=pounce +pounce_verbose=true + +# specify the location of the configuration file for an IRC network +# pounce_config="/var/lib/pounce/.config/pounce/libera.conf" + +# if an initscript called pounce.libera is symlinked to the pounce initscript, +# the default log file will be /var/log/pounce.libera.log +# output_log=/var/log/pounce.log" +# error_log=/var/log/pounce.log" diff --git a/testing/pounce/pounce.initd b/testing/pounce/pounce.initd new file mode 100644 index 00000000000..63641d15550 --- /dev/null +++ b/testing/pounce/pounce.initd @@ -0,0 +1,41 @@ +#!/sbin/openrc-run + +description="A multi-client, TLS-only IRC bouncer" + +: "${pounce_user:=pounce}" +: "${pounce_group:=pounce}" +: "${pounce_verbose:=false}" +: "${output_log:=/var/log/${RC_SVCNAME}.log}" +: "${error_log:=/var/log/${RC_SVCNAME}.log}" + +instance_name="${RC_SVCNAME#*.}" +[ "$instance_name" != "pounce" ] \ + && name="pounce ($instance_name)" \ + || name="pounce" + +command=/usr/bin/pounce +command_background="true" +pidfile="/run/${RC_SVCNAME}.pid" +command_user="${pounce_user}:${pounce_group}" + +if yesno "${pounce_verbose}"; then + command_args="-v $pounce_config" +else + commmand_args="$pounce_config" +fi + +depend() { + need localmount net + use dns +} + +start_pre() { + [ -n "$output_log" ] && checkpath -q -f -m 0640 \ + -o "$command_user" "$output_log" + + [ -n "$error_log" ] && checkpath -q -f -m 0640 \ + -o "$command_user" "$error_log" + + [ -n "$pounce_config" ] && checkpath -q -f -m 0640 \ + -o "$command_user" "$pounce_config" +} diff --git a/testing/pounce/pounce.pre-install b/testing/pounce/pounce.pre-install new file mode 100644 index 00000000000..99dfa6c47a4 --- /dev/null +++ b/testing/pounce/pounce.pre-install @@ -0,0 +1,5 @@ +#!/bin/sh + +addgroup -S pounce 2> /dev/null +adduser -S -D -H -h /var/lib/pounce -s /sbin/nologin -G pounce -g 'pounce irc bouncer' pounce 2> /dev/null +exit 0