aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--audio/nas/README5
-rw-r--r--audio/nas/doinst.sh26
-rw-r--r--audio/nas/nas.SlackBuild14
-rw-r--r--audio/nas/rc.nasd.new38
4 files changed, 76 insertions, 7 deletions
diff --git a/audio/nas/README b/audio/nas/README
index 901e77f522b03..4bf7d8cbf04c2 100644
--- a/audio/nas/README
+++ b/audio/nas/README
@@ -9,8 +9,11 @@ See the /etc/nas/nasd.conf.eg for an example config.
Example server startup command:
-nasd :0 -aa &
+nasd :0 -aa -b
Example client command:
AUDIOSERVER=192.168.1.2:0 mplayer -ao nas movie.avi
+
+For full description of options etc. please see nas(1), nasd(1)
+and nasd.conf(5).
diff --git a/audio/nas/doinst.sh b/audio/nas/doinst.sh
new file mode 100644
index 0000000000000..ff00c6585ea53
--- /dev/null
+++ b/audio/nas/doinst.sh
@@ -0,0 +1,26 @@
+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...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+preserve_perms etc/rc.d/rc.nasd.new
+
diff --git a/audio/nas/nas.SlackBuild b/audio/nas/nas.SlackBuild
index b82787d9b9e0d..89e7fbb89a6b7 100644
--- a/audio/nas/nas.SlackBuild
+++ b/audio/nas/nas.SlackBuild
@@ -23,7 +23,7 @@
PRGNAM=nas
VERSION=${VERSION:-1.9.3}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@@ -70,23 +70,25 @@ find . \
xmkmf
make World
-make install.man install DESTDIR=$PKG
+make install.man 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
+
+install -D -m0755 $CWD/rc.nasd.new $PKG/etc/rc.d/rc.nasd.new
+
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
README.CYGWIN README TODO doc/html doc/*.ps \
$PKG/usr/doc/$PRGNAM-$VERSION
-
-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
-
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
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.${PKGTYPE:-tgz}
diff --git a/audio/nas/rc.nasd.new b/audio/nas/rc.nasd.new
new file mode 100644
index 0000000000000..182b9c14c52da
--- /dev/null
+++ b/audio/nas/rc.nasd.new
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+start() {
+ if [ -x /usr/bin/nasd ]; then
+ if [ -n "$(pgrep nasd)" ]; then
+ echo "Starting nasd /usr/bin/nasd"
+ /usr/bin/nasd :0 -aa -b
+ else
+ echo "nasd already running"
+ exit 1
+ fi
+ fi
+}
+
+stop() {
+ killall nasd
+}
+
+restart() {
+ stop
+ sleep 1
+ start
+}
+
+case "$1" in
+ 'start')
+ start
+ ;;
+ 'stop')
+ stop
+ ;;
+ 'restart')
+ restart
+ ;;
+ *)
+ echo "usage $0 start|stop|restart" ;;
+esac
+