Date: Saturday, June 4, 2011 @ 08:37:21
  Author: bisson
Revision: 126308

deprecate /etc/defaultdomain, use /etc/conf.d/nisdomainname instead

Added:
  ypbind-mt/trunk/nisdomainname.conf
Modified:
  ypbind-mt/trunk/PKGBUILD
  ypbind-mt/trunk/ypbind

--------------------+
 PKGBUILD           |   10 ++++++---
 nisdomainname.conf |    4 +++
 ypbind             |   55 +++++++++++++++++++++++++--------------------------
 3 files changed, 38 insertions(+), 31 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2011-06-04 12:35:04 UTC (rev 126307)
+++ PKGBUILD    2011-06-04 12:37:21 UTC (rev 126308)
@@ -5,19 +5,22 @@
 
 pkgname=ypbind-mt
 pkgver=1.33
-pkgrel=1
+pkgrel=2
 pkgdesc='Linux NIS daemon'
 arch=('i686' 'x86_64')
 url='http://www.linux-nis.org/nis/ypbind-mt/'
 license=('GPL2')
 depends=('rpcbind' 'openslp')
-backup=('etc/yp.conf' 'etc/conf.d/ypbind')
+optdepends=('yp-tools: to set a domain name')
+backup=('etc/yp.conf' 'etc/conf.d/ypbind' 'etc/conf.d/nisdomainname')
 source=("ftp://ftp.kernel.org/pub/linux/utils/net/NIS/$pkgname-$pkgver.tar.gz";
+        'nisdomainname.conf'
         'ypbind.conf'
         'ypbind')
 sha1sums=('49f578d15aa5d4f4130a2e96cd9c0e519263fc88'
+          'eb00aecc0679e25a36b007e797f4468b40cb3e8e'
           '07dee386d001fb9e9e6b76dda8af5b2092e5a4a2'
-          '66f6ea2f622e0724e6017bf835d4f7f4a5bf9534')
+          '112fc2aedfe3f761325b69647b7938bc1be5bfcd')
 
 build() {
        cd "$srcdir/$pkgname-$pkgver"
@@ -31,5 +34,6 @@
        install -D -m644 etc/yp.conf "$pkgdir"/etc/yp.conf
        install -D -m755 ../ypbind "$pkgdir"/etc/rc.d/ypbind
        install -D -m644 ../ypbind.conf "$pkgdir"/etc/conf.d/ypbind
+       install -D -m644 ../nisdomainname.conf 
"$pkgdir"/etc/conf.d/nisdomainname
        install -d -m755 "$pkgdir"/var/yp/binding
 }

Added: nisdomainname.conf
===================================================================
--- nisdomainname.conf                          (rev 0)
+++ nisdomainname.conf  2011-06-04 12:37:21 UTC (rev 126308)
@@ -0,0 +1,4 @@
+#
+# NIS domain to be set in /etc/rc.d/ypbind
+#
+NISDOMAINNAME=""

Modified: ypbind
===================================================================
--- ypbind      2011-06-04 12:35:04 UTC (rev 126307)
+++ ypbind      2011-06-04 12:37:21 UTC (rev 126308)
@@ -2,35 +2,34 @@
 
 . /etc/rc.conf
 . /etc/rc.d/functions
+
 . /etc/conf.d/ypbind
+. /etc/conf.d/nisdomainname
 
+name=ypbind
+PID=$(pidof -o %PPID /usr/sbin/ypbind)
+
 case "$1" in
-  start)
-    stat_busy "Starting NIS Bind Daemon"
-    [ -f /etc/defaultdomain ] && /bin/domainname -F /etc/defaultdomain
-    /usr/sbin/ypbind $YPBIND_ARGS
-    if [ $? -gt 0 ]; then
-      stat_fail
-    else
-      add_daemon ypbind
-      stat_done
-    fi
-    ;;
-  stop)
-    stat_busy "Stopping NIS Bind Daemon"
-    killall -q /usr/sbin/ypbind
-    if [ $? -gt 0 ]; then
-      stat_fail
-    else
-      rm_daemon ypbind
-      stat_done
-    fi
-    ;;
-  restart)
-    $0 stop
-    sleep 1
-    $0 start
-    ;;
-  *)
-    echo "usage: $0 {start|stop|restart}"  
+start)
+       stat_busy "Starting $name daemon"
+       [[ -n $NISDOMAINNAME ]] && /usr/bin/domainname "$NISDOMAINNAME" 
&>/dev/null
+       [[ -z "$PID" ]] && /usr/sbin/ypbind $YPBIND_ARGS &>/dev/null \
+       && { add_daemon $name; stat_done; } \
+       || { stat_fail; exit 1; }
+       ;;
+stop)
+       stat_busy "Stopping $name daemon"
+       [[ -n "$PID" ]] && kill $PID &>/dev/null \
+       && { rm_daemon $name; stat_done; } \
+       || { stat_fail; exit 1; }
+       ;;
+restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+*)
+       echo "usage: $0 {start|stop|restart}"
+       exit 1
+       ;;
 esac

Reply via email to