| #!/bin/sh |
| # |
| # ypbind-domain |
| # |
| # description: This is part of former ypbind init script, which is used |
| # to setup proper domainname before starting ypbind daemon |
| # itself. If $NISDOMAIN is not defined, it reads config file. |
| # |
| |
| TIMEOUT=5 |
| DOMAINNAME=`domainname` |
| if [ "$DOMAINNAME" = "(none)" -o "$DOMAINNAME" = "" ]; then |
| echo -n $"Setting NIS domain: " |
| seconds=0 |
| while [ $seconds -lt $TIMEOUT ]; do |
| if [ -n "$NISDOMAIN" ]; then |
| domainname $NISDOMAIN |
| echo $"'$NISDOMAIN' (environment variable)" |
| break |
| else # See if the domain is set in config file |
| NISDOMAIN=`awk '{ if ($1 == "domain") {print $2; exit} }' /etc/yp.conf` |
| if [ -n "$NISDOMAIN" ]; then |
| domainname $NISDOMAIN |
| echo $"'$NISDOMAIN' (/etc/yp.conf)" |
| break |
| else |
| seconds=$(($seconds+1)) |
| sleep 1 |
| fi |
| fi |
| done |
| # Give up if NISDOMAIN is still not set |
| [ -z "$NISDOMAIN" ] && logger -t ypbind $"domain not found" && exit 1 |
| fi |
| |
| #/etc/rpc check |
| grep ypbind /etc/rpc > /dev/null 2>&1 |
| if [ $? -ne 0 ]; then |
| logger -t ypbind $"Error: Missing ypbind entry in /etc/rpc." |
| exit 1 |
| fi |
| |
| echo |
| |