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