summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--network/znc/README31
-rw-r--r--network/znc/README.SBo18
-rw-r--r--network/znc/doinst.sh22
-rw-r--r--network/znc/rc.znc62
-rw-r--r--network/znc/slack-desc8
-rw-r--r--network/znc/znc.SlackBuild72
-rw-r--r--network/znc/znc.info10
7 files changed, 180 insertions, 43 deletions
diff --git a/network/znc/README b/network/znc/README
index 2c98d13845..7a352cbed2 100644
--- a/network/znc/README
+++ b/network/znc/README
@@ -3,24 +3,21 @@ ZNC is an advanced IRC bouncer
ZNC will remain connected to an IPv4 or IPv6 IRC server even while you
are offline. You can reattach your client at a later time and catch up
with what happened while you were gone via the history buffer. You can
-add additional users under one running process: useful for public shells
+add additional users under one running process, useful for public shells
that limit background processes. ZNC also supports the dynamic loading
of C++ and Perl modules.
-Once the package is installed, you can interactivly create your znc.conf
-using the following command:
- /usr/bin/znc --makeconf --datadir /etc/znc
-Once you have answered all the questions, your znc.conf file will be located
-at /etc/znc/configs/znc.conf.
+The SlackBuild file for ZNC includes support for OpenSSL connections
+to IRC servers. If you do not wish to include OpenSSL support in ZNC,
+simply run the build script like this:
+ WITH_SSL=no ./znc.SlackBuild
-It is recommended that you do *NOT* run znc as 'root' but rather as a
-more benign user such as 'nobody'. It should be noted that you can
-only run as a non-root user if you choose a listening port higher than
-1024. The following is necessary to allow znc to be run as the 'nobody'
-user; it only needs to be run once:
- chown -R nobody:nobody /etc/znc
-To actually execute ZNC as the 'nobody' user, use the following command:
- su - nobody -c '/usr/bin/znc --datadir /etc/znc'
-By default, ZNC will look for its configuration file in ~/.znc. If you
-used the '--datadir' option when creating the znc.conf file, it must also
-be used when starting ZNC.
+IPv6 support is also enabled by default; to disable it, run the script as:
+ WITH_IPV6=no ./znc.SlackBuild
+
+This is intended to be run as a nonprivileged user - by default, the
+build script uses "znc" as the user. If you wish to change it, e.g.
+to use the "nobody" user, then run the script as follows:
+ ZNC_USER=nobody ./znc.SlackBuild
+
+See README.SBo for configuration information.
diff --git a/network/znc/README.SBo b/network/znc/README.SBo
new file mode 100644
index 0000000000..a9972a7b5c
--- /dev/null
+++ b/network/znc/README.SBo
@@ -0,0 +1,18 @@
+znc README.SBo
+
+Once the package is installed, you should create your config file using
+znc's own interactive utility; run the following command:
+ su - _ZNC_USER_ -c '/usr/bin/znc --makeconf --datadir /etc/znc'
+
+Since znc is configured to run as a nonprivileged user by default in
+this build script, you must choose a listening port higher than 1024.
+
+Once you have answered all the questions, your znc.conf file will be
+located at /etc/znc/configs/znc.conf
+
+It should be noted that by default (if run without any arguments), ZNC
+will look for its configuation file in ~/.znc (which is /etc/znc/.znc
+as suggested by the build script). This is irrelevant if you are using
+the init script supplied with the package, but it might be worth knowing
+just in case.
+
diff --git a/network/znc/doinst.sh b/network/znc/doinst.sh
new file mode 100644
index 0000000000..d888165f22
--- /dev/null
+++ b/network/znc/doinst.sh
@@ -0,0 +1,22 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+# Keep same perms on rc.znc.new:
+if [ -e etc/rc.d/rc.znc ]; then
+ cp -a etc/rc.d/rc.znc etc/rc.d/rc.znc.new.incoming
+ cat etc/rc.d/rc.znc.new > etc/rc.d/rc.znc.new.incoming
+ mv etc/rc.d/rc.znc.new.incoming etc/rc.d/rc.znc.new
+fi
+
+config etc/rc.d/rc.znc.new
+
diff --git a/network/znc/rc.znc b/network/znc/rc.znc
new file mode 100644
index 0000000000..85d58929ce
--- /dev/null
+++ b/network/znc/rc.znc
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# Start/stop/restart znc
+
+# User account under which ZNC should run; only change this if you
+# know what you are doing :-)
+ZNC_USER="_ZNC_USER_"
+
+# First, a sanity check
+if [[ ! -e /etc/znc/configs/znc.conf ]]; then
+ echo "Warning: /etc/znc/configs/znc.conf does not exist."
+ echo "You should create a config file by running the following command:"
+ echo " su - $ZNC_USER -c '/usr/bin/znc --makeconf --datadir=/etc/znc'"
+ exit 1
+fi
+
+znc_start() {
+ if [[ -e /var/lock/znc ]]; then
+ echo "ZNC is already running, or there is a stale lock file at "
+ echo "/var/lock/znc - if you are sure that znc is not already "
+ echo "running, then remove the lock and try again."
+ return 1
+ else
+ su - $ZNC_USER -c '/usr/bin/znc --datadir /etc/znc' && touch /var/lock/znc
+ return 0
+ fi
+}
+
+znc_stop() {
+ killall znc 2>/dev/null
+ RETVAL=$?
+ if (( "$RETVAL" != 0 )); then
+ echo "ZNC does not appear to be running..."
+ else
+ rm -f /var/lock/znc
+ fi
+ return $RETVAL
+}
+
+znc_restart() {
+ znc_stop
+ sleep 1
+ znc_start
+}
+
+case "$1" in
+ 'start')
+ znc_start
+ ;;
+ 'stop')
+ znc_stop
+ ;;
+ 'restart')
+ znc_restart
+ ;;
+ *)
+ echo "Usage: $0 start|stop|restart"
+ exit 1
+esac
+
+exit $?
+
diff --git a/network/znc/slack-desc b/network/znc/slack-desc
index ee81e23d25..73aa173012 100644
--- a/network/znc/slack-desc
+++ b/network/znc/slack-desc
@@ -5,15 +5,15 @@
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
- |-----handy-ruler--------------------------------------------------------|
-znc: ZNC (advanced IRC bouncer)
+ |-----handy-ruler------------------------------------------------------|
+znc: ZNC (an advanced IRC bouncer)
znc:
znc: ZNC will remain connected to an IPv4 or IPv6 IRC server even while you
znc: are offline. You can reattach your client at a later time and catch up
znc: with what happened while you were gone via the history buffer. You can
-znc: add additional users under one running process,useful for public shells
+znc: add additional users under one running process, useful for public shells
znc: that limit background processes. ZNC also supports the dynamic loading
znc: of C++ and Perl modules.
znc:
-znc:
+znc: Homepage: http://en.znc.in/wiki/ZNC
znc:
diff --git a/network/znc/znc.SlackBuild b/network/znc/znc.SlackBuild
index 161d88650c..063ce59755 100644
--- a/network/znc/znc.SlackBuild
+++ b/network/znc/znc.SlackBuild
@@ -1,8 +1,8 @@
#!/bin/sh
-# Slackware build script for VDE2
+# Slackware build script for ZNC
-# Copyright 2007-2008 Sean Donner (sean.donner@sbcglobal.net)
+# Copyright 2007-2009 Sean Donner (sean.donner at gmail dot com)
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -23,11 +23,15 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=znc
-VERSION=0.052
+VERSION=0.062
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
+ZNC_USER=${ZNC_USER:-znc}
+WITH_SSL=${WITH_SSL:-yes}
+WITH_IPV6=${WITH_IPV6:-yes}
+
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
@@ -39,39 +43,73 @@ elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
fi
+# Bail if user and/or group isn't valid on your system
+# uid=219 is suggested to avoid conflicts with other SBo packages,
+# but it's your call: http://slackbuilds.org/uid_gid.txt
+if ! grep -q "^$ZNC_USER:" /etc/passwd; then
+ echo " You must have a $ZNC_USR user to run this script. "
+ echo " Something like this should suffice for most systems: "
+ echo " # useradd -u 219 -g 99 -c \"ZNC User\" -d /etc/znc $ZNC_USER"
+ exit 1
+fi
+
+set -e
+
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
-tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || exit 1
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
+if [ "$WITH_SSL" != "yes" ]; then
+ do_openssl="--without-openssl"
+else
+ do_openssl="--with-openssl"
+fi
+
+if [ "$WITH_IPV6" != "yes" ]; then
+ do_ipv6="--disable-ipv6"
+else
+ do_ipv6="--enable-ipv6"
+fi
+
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
- --prefix=/usr \
- --sysconfdir=/etc \
- --localstatedir=/var \
- --mandir=/usr/man \
- --with-openssl \
- --enable-ipv6
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --build=$ARCH-slackware-linux \
+ $do_openssl \
+ $do_ipv6
+
+make all
+make install DESTDIR=$PKG
-make all || exit 1
-make install DESTDIR=$PKG || exit 1
+# Change the ownership of the configuration directory
+mkdir -p $PKG/etc/znc
+chown -R $ZNC_USER $PKG/etc/znc
-( cd $PKG
- find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
- find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
-)
+# Install an init script
+mkdir -p $PKG/etc/rc.d
+sed -e "s/_ZNC_USER_/$ZNC_USER/g" -e "s/_VERSION_/$VERSION/g" $CWD/rc.znc \
+ > $PKG/etc/rc.d/rc.znc.new
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
-cp -a AUTHORS LICENSE* README $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ AUTHORS LICENSE* README \
+ $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+sed s/_ZNC_USER_/$ZNC_USER/g $CWD/README.SBo > \
+ $PKG/usr/doc/$PRGNAM-$VERSION/README.SBo
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
diff --git a/network/znc/znc.info b/network/znc/znc.info
index f9dda18e58..64b6ed7c11 100644
--- a/network/znc/znc.info
+++ b/network/znc/znc.info
@@ -1,8 +1,8 @@
PRGNAM="znc"
-VERSION="0.052"
-HOMEPAGE="http://znc.sf.net"
-DOWNLOAD="http://downloads.sourceforge.net/znc/znc-0.052.tar.gz"
-MD5SUM="726046e3b44d811ededf4e850b5e0f06"
+VERSION="0.062"
+HOMEPAGE="http://en.znc.in/wiki/ZNC"
+DOWNLOAD="http://downloads.sourceforge.net/znc/znc-0.062.tar.gz"
+MD5SUM="692b8e65a7363ac3fc0e10a0cb3cd1aa"
MAINTAINER="Sean Donner"
-EMAIL="sean.donner@sbcglobal.net"
+EMAIL="sean.donner at gmail dot com"
APPROVED="rworkman"