Blame SOURCES/ypbind-pre-setdomain

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