Blame SOURCES/ypbind-pre-setdomain

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