Blame SOURCES/ypbind-pre-setdomain

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