aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Preksavec <mario@slackware.hr>2024-11-17 14:01:21 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2024-11-23 10:50:53 +0700
commit2f93324ec98e729151a9c977b388aa9cc1b763f1 (patch)
treebf2b760b18ea8d830e189227d0fe971173edbadb
parentb233f275a337cfb221e8ebfd5687b90214d2efb6 (diff)
network/znc: Cleaned up RC script, manuals fix.
Signed-off-by: Mario Preksavec <mario@slackware.hr> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--network/znc/rc.znc84
-rw-r--r--network/znc/znc.SlackBuild5
2 files changed, 42 insertions, 47 deletions
diff --git a/network/znc/rc.znc b/network/znc/rc.znc
index a02dda4d6f8e..16d930ebd97d 100644
--- a/network/znc/rc.znc
+++ b/network/znc/rc.znc
@@ -2,62 +2,54 @@
# 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
+[ -f /etc/default/znc ] && source /etc/default/znc
+
+ZNC_USER=${ZNC_USER:-@ZNC_USER@}
+ZNC_HOME=${ZNC_HOME:-/etc/znc}
+ZNC_PIDFILE=${ZNC_PIDFILE:-/run/znc.pid}
+
+if [ ! -e $ZNC_HOME/configs/znc.conf ]; then
+ echo "Warning: $ZNC_HOME/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=$ZNC_HOME'"
+ 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
+ if [ -e $ZNC_PIDFILE ]; then
+ echo "ZNC is already running, or there is a stale pid file at"
+ echo "$ZNC_PIDFILE - if you are sure that znc is not already"
+ echo "running, then remove the file and try again."
+ return 1
+ else
+ su - $ZNC_USER -c "/usr/bin/znc --datadir $ZNC_HOME"
+ echo $$ > $ZNC_PIDFILE
+ return 0
+ fi
}
znc_stop() {
- killall -SIGINT 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
-}
+ killall -SIGINT znc 2>/dev/null
+ RETVAL=$?
+ if [ $RETVAL -ne 0 ]; then
+ echo "ZNC does not appear to be running..."
+ else
+ rm -f $ZNC_PIDFILE
+ fi
+ return $RETVAL
+}
znc_restart() {
- znc_stop
- sleep 1
- znc_start
+ 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
+case $1 in
+ start) znc_start ;;
+ stop) znc_stop ;;
+ restart) znc_restart ;;
+ *) echo "Usage: $0 start|stop|restart" ;;
esac
exit $?
-
diff --git a/network/znc/znc.SlackBuild b/network/znc/znc.SlackBuild
index b271ede7636a..a4d20a72f460 100644
--- a/network/znc/znc.SlackBuild
+++ b/network/znc/znc.SlackBuild
@@ -27,7 +27,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=znc
VERSION=${VERSION:-1.9.1}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -160,6 +160,9 @@ make install DESTDIR=$PKG
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
# Change the ownership of the configuration directory
mkdir -p $PKG/etc/znc
chown -R $ZNC_USER $PKG/etc/znc