wok rev 11349

ypserv: improve receipt
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Tue Nov 29 01:25:59 2011 +0100 (2011-11-29)
parents 5b8ecc246338
children 43ed4e348b0d
files ypserv/receipt ypserv/stuff/ypserv
line diff
     1.1 --- a/ypserv/receipt	Tue Nov 29 00:55:52 2011 +0100
     1.2 +++ b/ypserv/receipt	Tue Nov 29 01:25:59 2011 +0100
     1.3 @@ -7,7 +7,7 @@
     1.4  MAINTAINER="pascal.bellard@slitaz.org"
     1.5  TARBALL="$PACKAGE-$VERSION.tar.gz"
     1.6  WEB_SITE="http://www.kernel.org/pub/linux/utils/net/NIS/"
     1.7 -DEPENDS="gdbm"
     1.8 +DEPENDS="gdbm portmap"
     1.9  BUILD_DEPENDS="gdbm-dev"
    1.10  WGET_URL="$WEB_SITE/$TARBALL"
    1.11  
    1.12 @@ -25,9 +25,22 @@
    1.13  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.14  genpkg_rules()
    1.15  {
    1.16 -	mkdir -p $fs/usr
    1.17 +	mkdir -p $fs/usr $fs/etc/init.d
    1.18  	cp -a $_pkg/usr/sbin $fs/usr
    1.19  	cp -a $_pkg/usr/lib $fs/usr
    1.20  	cp -a $_pkg/usr/include $fs/usr
    1.21  	cp -a $_pkg/var $fs
    1.22 +	
    1.23 +	# Copy config files
    1.24 +	for  file in ypserv.conf timezone netmasks netgroup
    1.25 +	do 
    1.26 +		cp -a $src/etc/$fle $fs/
    1.27 +	done
    1.28 +	
    1.29 +	# Copy initscript
    1.30 +	cp $stuff/ypserv $fs/etc/init.d
    1.31 +	
    1.32 +	# Copy and fix security file
    1.33 +	cp $src/etc/securenets $fs/var/yp
    1.34 +	sed -i 's/^0.0.0.0/#0.0.0.0/' $fs/var/yp/securenets
    1.35  }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/ypserv/stuff/ypserv	Tue Nov 29 01:25:59 2011 +0100
     2.3 @@ -0,0 +1,56 @@
     2.4 +#!/bin/sh
     2.5 +# /etc/init.d/ypserv: Start, stop and restart YP (NIS) Server on SliTaz, at 
     2.6 +# boot time or with the command line.
     2.7 +#
     2.8 +# To start YP (NIS) Server at boot time, just put ypserver in the $RUN_DAEMONS
     2.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf
    2.10 +#
    2.11 +. /etc/init.d/rc.functions
    2.12 +. /etc/daemons.conf
    2.13 +
    2.14 +NAME=ypserv
    2.15 +DESC="YP (NIS) Server"
    2.16 +DAEMON=/usr/sbin/ypserv
    2.17 +OPTIONS=$YPSERV_OPTIONS
    2.18 +PIDFILE=/var/run/ypserv.pid
    2.19 +
    2.20 +case "$1" in
    2.21 +  start)
    2.22 +    if active_pidfile $PIDFILE ypserv ; then
    2.23 +      echo "$NAME already running."
    2.24 +      exit 1
    2.25 +    fi
    2.26 +    echo -n "Starting $DESC: $NAME... "
    2.27 +    $DAEMON $OPTIONS
    2.28 +    echo "$(pidof ypserv)" > $PIDFILE
    2.29 +    status
    2.30 +    ;;
    2.31 +  stop)
    2.32 +    if ! active_pidfile $PIDFILE ypserv ; then
    2.33 +      echo "$NAME is not running."
    2.34 +      exit 1
    2.35 +    fi
    2.36 +    echo -n "Stopping $DESC: $NAME... "
    2.37 +    kill `cat $PIDFILE`
    2.38 +    status
    2.39 +    ;;
    2.40 +  restart)
    2.41 +    if ! active_pidfile $PIDFILE ypserv ; then
    2.42 +      echo "$NAME is not running."
    2.43 +      exit 1
    2.44 +    fi
    2.45 +    echo -n "Restarting $DESC: $NAME... "
    2.46 +    kill `cat $PIDFILE`
    2.47 +    sleep 2
    2.48 +    $DAEMON $OPTIONS
    2.49 +    status
    2.50 +    ;;
    2.51 +  *)
    2.52 +    echo ""
    2.53 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    2.54 +    echo ""
    2.55 +    exit 1
    2.56 +    ;;
    2.57 +esac
    2.58 +
    2.59 +exit 0