aboutsummaryrefslogtreecommitdiffstats
path: root/community/znc
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2018-07-18 08:02:59 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2018-07-18 08:05:06 +0000
commitab17ebc5ee95aaf5dd80dcd83e9ad004434ce475 (patch)
tree83fe86f9c17c1ea45d072f7c24a8c2b3496459c0 /community/znc
parent632ac8c24a84ce04b05d979594931855364cad45 (diff)
downloadaports-ab17ebc5ee95aaf5dd80dcd83e9ad004434ce475.tar.bz2
aports-ab17ebc5ee95aaf5dd80dcd83e9ad004434ce475.tar.xz
main/znc: move to community
Diffstat (limited to 'community/znc')
-rw-r--r--community/znc/APKBUILD114
-rw-r--r--community/znc/znc.confd7
-rw-r--r--community/znc/znc.initd47
-rw-r--r--community/znc/znc.pre-install6
4 files changed, 174 insertions, 0 deletions
diff --git a/community/znc/APKBUILD b/community/znc/APKBUILD
new file mode 100644
index 0000000000..9890e16b5a
--- /dev/null
+++ b/community/znc/APKBUILD
@@ -0,0 +1,114 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=znc
+pkgver=1.7.1
+pkgrel=0
+pkgdesc="Advanced IRC bouncer"
+url="http://znc.in"
+arch="all"
+license="Apache-2.0"
+makedepends="perl-dev libressl-dev cyrus-sasl-dev python2-dev c-ares-dev swig
+ gettext-dev tcl-dev autoconf automake python3-dev icu-dev"
+pkgusers="$pkgname"
+pkggroups="$pkgusers"
+install="$pkgname.pre-install"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-extra $pkgname-modtcl
+ $pkgname-modperl $pkgname-modpython"
+source="http://znc.in/releases/znc-$pkgver.tar.gz
+ $pkgname.initd
+ $pkgname.confd"
+builddir="$srcdir/znc-$pkgver"
+
+# secfixes:
+# 1.7.1-r0:
+# - CVE-2018-14055
+# - CVE-2018-14056
+
+build() {
+ cd "$builddir"
+
+ export CFLAGS="$CFLAGS -D_GNU_SOURCE"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var \
+ --enable-perl \
+ --enable-tcl \
+ --enable-python
+ make
+}
+
+package() {
+ cd "$builddir"
+
+ make DESTDIR="$pkgdir" install
+
+ install -D -m755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ install -D -m644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+ install -d -m750 -o $pkgusers -g $pkggroups "$pkgdir"/var/lib/znc
+}
+
+dev() {
+ default_dev
+ _mv_to_sub usr/bin/znc-buildmod
+}
+
+extra() {
+ pkgdesc="Extra modules for ZNC"
+
+ _mv_mod \
+ autovoice.so \
+ block_motd.so \
+ clearbufferonmsg.so \
+ ctcpflood.so \
+ flooddetach.so \
+ imapauth.so \
+ listsockets.so \
+ log.so \
+ notify_connect.so \
+ send_raw.so \
+ shell.so
+}
+
+modtcl() {
+ pkgdesc="TCL module for ZNC"
+ depends="znc"
+
+ _mv_mod modtcl.so
+ _mv_to_sub usr/share/znc/modtcl
+}
+
+modperl() {
+ pkgdesc="Perl module for ZNC"
+ depends="znc"
+
+ _mv_mod modperl modperl.so
+}
+
+modpython() {
+ pkgdesc="Python modules for ZNC"
+ depends="znc"
+
+ _mv_mod modpython modpython.so
+}
+
+_mv_mod() {
+ local i; for i in "$@"; do
+ _mv_to_sub usr/lib/znc/$i
+ done
+}
+
+_mv_to_sub() {
+ local i; for i in "$@"; do
+ mkdir -p "$subpkgdir"/${i%/*}
+ mv "$pkgdir"/$i "$subpkgdir"/$i
+ done
+}
+
+sha512sums="907068fb0828091026d440145b70ca76109302f13c18d94f772660192434287f209a06a52da1dd39726b9a38735b3cea9afbd062eb6def4cd428bb73c562a902 znc-1.7.1.tar.gz
+47f9bd00f07861e195333d2cda5b1c7386e2324a1842b890837a7936a94b65b7a269f7fee656a522ec86b58a94bd451a2a3629bd6465578681b8d0733c2c77dc znc.initd
+00360f9b487ed5a9d50c85ce597e65c89cf869cabb893c294d0bc7fcd88f9610ecb63ba6df7af1ba1dd977b6d5b05da625a3ee799a46d381f17ac04b976a1f29 znc.confd"
diff --git a/community/znc/znc.confd b/community/znc/znc.confd
new file mode 100644
index 0000000000..cb685239a8
--- /dev/null
+++ b/community/znc/znc.confd
@@ -0,0 +1,7 @@
+# Configuration for /etc/conf.d/znc
+
+# Location of the znc configuration folder.
+#datadir="/var/lib/znc"
+
+# User to run znc as.
+#command_user="znc"
diff --git a/community/znc/znc.initd b/community/znc/znc.initd
new file mode 100644
index 0000000000..b6c52791f6
--- /dev/null
+++ b/community/znc/znc.initd
@@ -0,0 +1,47 @@
+#!/sbin/openrc-run
+
+# Upper case variables are here for backward compatibility.
+: ${command_user:=${ZNC_USER:-"znc"}}
+: ${datadir:=${ZNC_CONF:-"/var/lib/znc"}}
+
+extra_started_commands="reload save"
+extra_stopped_commands="setup"
+description_reload="Reload ZNC configuration from disk"
+description_save="Save ZNC configuration to disk"
+description_setup="Interactively create a new config"
+
+command="/usr/bin/znc"
+command_args="-f -d $datadir ${command_args:-}"
+command_background="yes"
+pidfile="/run/$RC_SVCNAME.pid"
+
+depend() {
+ need net
+}
+
+start_pre() {
+ if [ ! -f "$datadir"/configs/znc.conf ]; then
+ eerror "File $datadir/configs/znc.conf does not exist!"
+ eerror "Run 'rc-service $RC_SVCNAME setup' to create ZNC configuration."
+ return 1
+ fi
+}
+
+reload() {
+ ebegin "Reloading ZNC configuration from disk"
+ start-stop-daemon --signal SIGHUP --pidfile "$pidfile"
+ eend $?
+}
+
+save() {
+ ebegin "Saving ZNC configuration to disk"
+ start-stop-daemon --signal SIGUSR1 --pidfile "$pidfile"
+ eend $?
+}
+
+setup() {
+ ebegin "Creating a new ZNC config"
+ checkpath -d -m 750 -o "$command_user" "$datadir"
+ su "$command_user" -s /bin/sh -c "$command $command_args --makeconf"
+ eend $?
+}
diff --git a/community/znc/znc.pre-install b/community/znc/znc.pre-install
new file mode 100644
index 0000000000..e65de696b3
--- /dev/null
+++ b/community/znc/znc.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S znc 2>/dev/null
+adduser -S -D -H -h /var/lib/znc -s /sbin/nologin -G znc -g znc znc 2>/dev/null
+
+exit 0