:
#	SCO Modifications: @(#)ypinit.sh	2.2 92/05/06 
#      @(#)ypinit.sh	4.18.1.5 System V NFS  source
#      SCCS IDENTIFICATION
#
#	System V NFS
#
#	Copyright 1986-1989 Lachman Associates, Incorporated (LAI)
#
#	All Rights Reserved.
#
#	The copyright above and this notice must be preserved in all
#	copies of this source code.  The copyright above does not
#	evidence any actual or intended publication of this source
#	code.
#
#	This is unpublished proprietary trade secret source code of
#	Lachman Associates.  This source code may not be copied,
#	disclosed, distributed, demonstrated or licensed except as
#	expressly authorized by Lachman Associates.
#

#	@(#)ypinit.sh 1.1 86/02/05 Copyr 1984 Sun Microsystems, Inc.  

# ypinit.sh - set up a populated yp directory structure on a master server,
# a slave server, or a slave copier.

# Prompt for yes or no answer with message passed as argument - 
# returns non-zero for yes
getyn() {
	while	echo "\n$* (y/n/q) \c">&2
	do	read yn rest
		case $yn in
			[yY]) return 1				;;
			[nN]|[qQ]) return 0			;;
		*)	echo "Please answer y,n or q" >&2	;;
		esac
	done
}



# Re-make new kernel
relink() {
    [ "$_RELINK" ] && return
    cd /etc/conf/cf.d
    opt=-y
    if [ -z "$_NOPROMPT" ] ; then
	    echo "\nRe-linking the kernel ... \c" >&2
	    opt=
    fi
    ./link_unix $opt 2>&1 | tee -a kmakelog || {
	    echo "\nError:  Kernel make failed.
Check /etc/conf/cf.d/kmakelog for details." >&2
	    cleanup 1
    }
    rm -f kmakelog
    return 0
}

# 
# update streams buffers and relink if necessary
#
check_conf(){
	string=`grep NBLK128 /etc/conf/cf.d/stune`
	set $string
	if [ $2 -lt 256 ] ; then
		cd /etc/conf/bin
		./idtune -f NBLK128 256
		echo "Streams buffers sizes have been updated"
		if getyn "\nDo you wish to relink the kernel now?" ; then
			echo "\nChanges will not take effect until the kernel is relinked and the \nsystem is rebooted"
		else
			relink
			# Install the kernel in the default location
			# installkernel
		fi
	fi
}

error_exit() {
	if [ -d /usr/lib/nisrt ] ; 
	then
		cp $etcsave_dir/nfs $etcroot_dir/nfs > /dev/null 2>&1
		cp $etcsave_dir/passwd $etcroot_dir/passwd > /dev/null 2>&1
		/bin/rm /bin/passwd > /dev/null 2>&1
		cp $binsave_dir/passwd $binroot_dir/passwd > /dev/null 2>&1
		chmod 2111 /bin/passwd > /dev/null 2>&1
		chgrp auth /bin/passwd > /dev/null 2>&1
		chown bin /bin/passwd > /dev/null 2>&1
		/bin/rm /etc/*.local > /dev/null 2>&1
		/bin/rm /etc/*.yp > /dev/null 2>&1
		/bin/rm -rf /usr/lib/nisrt > /dev/null 2>&1
		/bin/rm -rf /etc/yp/ypinit_done > /dev/null 2>&1
		/bin/rm -rf /bin/yppasswd > /dev/null 2>&1
	fi
	domainname unknown > /dev/null 2>&1
	exit 1
}

secure_error()
{
tput clear
echo "\n\typinit: ERROR: Invalid configuration."
echo "\tThe security settings of this system are incompatible with the"
echo "\tNIS configuration requested. Please refer to your Release and"
echo "\tInstallation Notes for further details.  Initialization Aborted."
error_exit
}

secure_restrictions()
{
tput clear
echo "\n\tDue to the restrictions of running NIS under the current security"
echo "\tsetting of this system, this server will accept, but not integrate"
echo "\tsensitive maps received through NIS.  Please refer to your Release"
echo "\tand Installation Notes for further details."
echo "\n\tHit return to continue \c"
read cr
}

get_ypbind(){
while [ "$ypbind_set" = "N" ]
do
	tput clear
	echo "You must specify whether ypbind is to be run with the secure"
	echo "option (-s), the ypset option (-ypset), allowing anyone to "
	echo "change your binding, or the ypsetme option (-ypsetme) which"
	echo "only allows requests with $host's IP address to change   "
	echo "$host's binding, or with no options.  \nPlease see ypserv(NADM) for more information"
	echo "\n\t\t1) ypbind -s"
	echo "\t\t2) ypbind -ypset"
	echo "\t\t3) ypbind -ypsetme"
	echo "\t\t4) ypbind "
	echo "\nPlease entry your choice (1-4,q)\c:"
	read ypbind_type
	case $ypbind_type in
		1)	YPBIND_OPTION=-s; ypbind_set=YES;;
		2)	YPBIND_OPTION=-ypset; ypbind_set=YES;;
		3)	YPBIND_OPTION=-ypsetme; ypbind_set=YES;;
		4)	YPBIND_OPTION=; ypbind_set=YES;;
		q)	error_exit ;;
		*)	;;
	esac
done
}
get_flags(){
while [ "$master_set" = "N" ]
do
	tput clear
	echo "\n\n\tYou must specify whether this host is to be a master, slave server, or"
	echo "\tcopy_only server.  Please enter the server type:[mscq] \c"
	read master_type
	case $master_type in
		m)	if [ $secure_machine -eq 1 ] ; 
			  then
				secure_error
			  else
				masterp=T;
				master_set=YES;
			fi;;	

		s)	if [ $secure_machine -eq 1 ] ; 
			  then
				secure_error
			  else
				slavep=T;
				master_set=YES;
			fi;;

		c)	if [ $secure_machine -eq 1 ] ; 
			  then
				secure_restrictions
			fi	
			copierp=T;
			master_set=YES;;

		q)	error_exit ;;
		*)	;;
	esac
done
}

get_host(){
if [ "$slavep" = "T" -o "$copierp" = "T" ]
then
	tput clear
	while [ "$master_host" = "N" ]
	do
		echo "\n\n\tYou must specify a host name to act as the NIS master \n\tduring map transfer [q to quit]: \c"
		read master 
		case $master in
			q)	error_exit ;;
			[a-p,r-z,A-Z]*) master_host=YES;;
			*) echo "\tInvalid host name"
		esac
	done
fi
}

log(){
	echo "\n$*" 
	echo "\nypinit: $*" >> /usr/adm/nislog
}

nis_backup()
{
if [ -d /usr/lib/nisrt ];
then		
	tput clear
	echo "\n\tThe backup directory /usr/lib/nisrt already exists"
	if getyn "\n\t Do you wish to continue with the SCO NIS Runtime System \n\t Initialization?" ; 
	  then
		exit 1 
	fi
fi

echo "\nBacking up system passwd files..."
/bin/mkdir /usr/lib/nisrt 1>/dev/null 2>&1
/bin/mkdir /usr/lib/nisrt/etc 1>/dev/null 2>&1
/bin/mkdir /usr/lib/nisrt/bin 1>/dev/null 2>&1
/bin/cp /etc/nfs /usr/lib/nisrt/etc/nfs 1>/dev/null 2>&1
/bin/cp /etc/passwd /usr/lib/nisrt/etc/passwd 1>/dev/null 2>&1
/bin/cp /etc/shadow /usr/lib/nisrt/etc/shadow 1>/dev/null 2>&1
/bin/cp /bin/passwd /usr/lib/nisrt/bin/passwd 1>/dev/null 2>&1
/bin/chmod 2111 /usr/lib/nisrt/bin/passwd
/bin/chown bin /usr/lib/nisrt/bin/passwd
/bin/chgrp auth /usr/lib/nisrt/bin/passwd
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z ;
do
  if [ -d /tcb/files/auth/$i ]; then
	if [ ! -d /usr/lib/nisrt/tcb/files/auth/$i ];
	  then
		mkdir -p /usr/lib/nisrt/tcb/files/auth/$i
	fi
	cp /tcb/files/auth/$i/* /usr/lib/nisrt/tcb/files/auth/$i 1>/dev/null 2>&1
  fi
done
}
etcsave_dir=$ROOT/usr/lib/nisrt/etc
binsave_dir=$ROOT/usr/lib/nisrt/bin
etcroot_dir=$ROOT/etc
binroot_dir=$ROOT/bin
yproot_dir=$ROOT/etc/yp
maps=`oawk '{print $1 ; }' $yproot_dir/YP_MAP_X_LATE`
hf=/tmp/yp$$
XFR=${YPXFR-$ROOT/etc/yp/ypxfr}
master_set=N
master_host=N
ypbind_set=N
ypbind_type=N
YPBIND_OPTION=
masterp=F
slavep=F
copierp=F
host=""
def_dom=""
secure_machine=""
master=""
got_host_list=F
errors_in_setup=F
do_get_flags=0

PATH=$PATH:/etc:/etc/yp
export PATH 

#
#main()
#

if [ -f /etc/yp/ypinit_done ] 
then
	tput clear
	echo "\tNIS has been initialized previously on this machine"
	echo "\tPlease verify that you would like to re-initialize NIS"
	echo "\tand then remove the file /etc/yp/ypinit_done"
	exit 1
fi

# check if we are in secure mode 
secure_machine=`/etc/yp/ypsecure; echo $?`

case $# in
1)	case $1 in
	-m)	if [ $secure_machine -eq 1 ] ; 
		  then
			secure_error
		  else
			masterp=T
	 	fi;;

	-s)	if [ $secure_machine -eq 1 ] ; 
		  then
			secure_error
		  else
			slavep=T
	 	fi;;

	-c)	if [ $secure_machine -eq 1 ] ; 
		  then
			secure_restrictions
	 	fi	
		copierp=T;;

	-q)	error_exit;;
	*)	do_get_flags=1;;
	esac;;

2)	case $1 in
	-s)	if [ $secure_machine -eq 1 ] ; 
		  then
			secure_error
		  else
			slavep=T
			master_host=Y
			master=$2
	 	fi;;

	-c)	if [ $secure_machine -eq 1 ] ; 
		  then
			secure_restrictions
	 	fi
		copierp=T;master_host=Y;master=$2;;

	*)	do_get_flags=1;;
	esac;;

*)	do_get_flags=1;;
esac

tput clear
# make sure they are in Single User mode.
set `who -r`
if [ $7 != 'S' ]
then
	echo "\nYou must be in System Maintenance Mode to initialize \c"
	echo "SCO NIS Runtime System.\nUse 'init 1' to bring the\c"
	echo " system to this run-level and rerun ypinit."
	exit 1
fi

# see if NIS already in /etc/nfs
nis_exists=`grep -c "SCO_NISRT" /etc/nfs`


if [ $do_get_flags = 1 ] 
then
	get_flags
fi

get_host

tput clear 

host=`hostname`

if [ $? -ne 0 ]
then 
	echo "Can't get local host's name.  Please check your path."
	error_exit 
fi

while [ -z "$host" ]
do
	echo "\nThe local host's name hasn't been set.  Please set it."
	echo "Please enter the host name or q to quit: \c"
	read host
	if [ "$host" = "q" ]
	then
		error_exit 
	fi
	hostname "$host"
	echo ""
done

def_dom=`domainname`

result=$?

if [ $result -ne 0 ]
then 
	if [ $result -eq 19 ]
	then
		echo "\nNFS is not configured into the booted kernel."
		echo "Please reboot the machine with a kernel that has NFS configured."
		error_exit
	else
	    echo "Can't get local host's domain name.  Please check your path."
	error_exit
	fi
fi

domainname "$def_dom"

if [ $? -ne 0 ]
then 
	echo "You have to be superuser to run $0 ..."
	error_exit
fi

while [ "$def_dom" = "unknown" ]
do
	echo "\nThe local host's domain name hasn't been set.  Please set it."
	echo "Please enter the domain name or q to quit: \c"
	read def_dom
	if [ "$def_dom" = "q" ]
	then
		error_exit 
	fi
	domainname "$def_dom"
	echo ""
done

if [ ! -d $yproot_dir -o -f $yproot_dir ]
then
    log "\
The directory $yproot_dir doesn't exist.  Restore it from the distribution."
	error_exit
fi

#
# get the ypbind option
#

if [ $slavep = T -o $copierp = T ]
then
	if [ $host = $master ]
	then
		log "\
The host specified should be a running master yp server, not this machine."
		error_exit
	fi
fi

echo "Installing the yp data base will require that you answer a few questions."
echo "Questions will all be asked at the beginning of the procedure."
echo ""

for dir in $yproot_dir/$def_dom
do

	if [ -d $dir ]; then
		echo "Can we destroy the existing $dir and its contents? [y/n/q: n]  \c"
		read kill_old_dir
		echo ""

		case $kill_old_dir in
		y*)	rm -r -f $dir

			if [ $?  -ne 0 ]
			then
			log "Can't clean up old directory $dir.  Fatal error."
			error_exit
			fi;;

		Y*)	rm -r -f $dir

			if [ $?  -ne 0 ]
			then
			log "Can't clean up old directory $dir.  Fatal error."
				error_exit
			fi;;

		q)	error_exit;;
		*)    echo "OK, please clean it up by hand and start again.  Bye"
				error_exit;;
		esac
	fi

	mkdir $dir

	if [ $?  -ne 0 ]
	then
		log "Can't make new directory $dir.  Fatal error."
		error_exit
	fi

done

if [ $secure_machine -eq 0 ] ; 
then
	if [ ! -f /etc/passwd.local ]
	then
		echo "\nNIS stores local logins in /etc/passwd.local, which currently"
		echo "doesn't exist on this machine.  The /etc/passwd.local file must be"
		echo "created before continuing."
		echo "\nIs it okay to copy /etc/passwd to /etc/passwd.local? [y/n/q: n] \c"
		
		read ans

		case $ans in
		'Y' | 'y')	
			echo ""
			;;

		q)	error_exit;;

		*)	
			log "\nOkay, create the /etc/passwd.local file and run ypinit again."
			error_exit ;;
		esac
	fi

	if [ ! -f /etc/group.local ]
	then
		echo "\nNIS stores local groups in /etc/group.local, which currently"
		echo "doesn't exist on this machine.  The /etc/group.local file must be"
		echo "created before continuing."
		echo "\nIs it okay to copy /etc/group to /etc/group.local? [y/n/q: n] \c"
		
		read ans

		case $ans in
		'Y' | 'y')
			echo ""
			;;

		q)	error_exit;;

		*)
			log "\nOkay, create the /etc/group.local file and run ypinit again."
			error_exit ;;
		esac
	fi
fi

#
# verify that the YP_MAP_XLATE file is what the user wants it to be.
#

tput clear
echo "\nThe YP_MAP_X_LATE file contains the following:"
for i in $maps; do
	echo $i
done
echo "\nIs this correct? [y/n/q: n] \c"
	
read ans

case $ans in
	'Y' | 'y')
		echo ""
		;;

	q)	error_exit;;

	*)
		log "\nOkay, edit the /etc/yp/YP_MAP_X_LATE file and run ypinit again."
		error_exit ;;
esac
tput clear

if [ $masterp = T ]
then
	if [ ! -f /etc/passwd.yp ]
	then
		echo "\nThe NIS network password file resides in /etc/passwd.yp on master"
		echo "servers only.  Since this node is being set up as a"
		echo "master server, /etc/passwd.yp must be created."
		echo "\nIs it okay to create /etc/passwd.yp? [y/n/q: n] \c"

		read ans

		case $ans in
		'Y' | 'y')
			echo ""
			;;

		q)	error_exit;;

		*)
			log "\nOkay, create the /etc/passwd.yp file and run ypinit again."
			error_exit ;;
		esac
	fi

	if [ ! -f /etc/group.yp ]
	then
		echo "\nThe NIS network group file resides in /etc/group.yp on master"
		echo "servers only.  Since this node is being set up as a master"
		echo "server, /etc/group.yp must be created."
		echo "\nIs it okay to copy /etc/group to /etc/group.yp? [y/n/q: n] \c"

		read ans

		case $ans in
		'Y' | 'y')
			echo ""
			;;

		q)	error_exit;;

		*)
			log "\nOkay, create the /etc/group.yp file and run ypinit again."
			error_exit ;;
		esac
	fi
fi

#
# now we get the ypbind options
#
get_ypbind

if [ $slavep = T -o $copierp = T ]
then

	tput clear
	echo "\n"
	echo "\
There will be no further questions. The remainder of the procedure should take"
	echo "a few minutes, to set up the NIS server"
	echo "\
\nThe NIS maps will be transferred from $master when \n$host goes to run level 2."

 # 
 # with the new ypinit, we do all the work at the end of the script, rather 
 # than when each question is answered.  If we got this far, that means that
 # all questions were answered affirmatively, and we can make the following
 # file modifications.
 #

nis_backup

if [ $secure_machine -eq 0 ] ; 
then
     # link /bin/passwd to /bin/yppasswd
	/bin/rm /bin/yppasswd > /dev/null
	/bin/ln /bin/passwd /bin/yppasswd 
fi

 # set up passwd.local
if [ $secure_machine -eq 0 ] ; 
then
 if [ ! -f /etc/passwd.local ] ;
  then
	/bin/cp /etc/passwd /etc/passwd.local
 fi
fi

if [ $secure_machine -eq 0 ] ; 
then
 # set up group.local
 if [ ! -f /etc/group.local ] ;
  then
	/bin/cp /etc/group /etc/group.local
 fi
fi

	if [ $slavep = T -a $nis_exists -eq 0 ]
	then
	ed - /etc/nfs << EOF
/^USAGE/a
# SCO_NISRT
YPDOMAIN="$def_dom"
# SCO_NISRT
.
w
q
EOF
	ed - /etc/nfs << EOF > /dev/null
50,90s/#domainname/domainname/
.
w
q
EOF
		ed - /etc/nfs << EOF
/^# Add additional SERVICES here/a
# SCO_NISRT

	echo "NIS services:\c"

	echo " ypserv\c"
	if [ -f /etc/resolv.conf -o -f /etc/named.boot ] ; then
		ypserv -d
	else
		ypserv
	fi
 
	echo " ypbind\c"
	ypbind $YPBIND_OPTION
 
#	echo " yppasswdd\c"
#	yppasswdd /etc/passwd.yp -m passwd SILENT=1
 
 	if [ -n "\$YPDOMAIN" -a -d /etc/yp/\$YPDOMAIN ]
 	then
 		echo " ypxfrd\c"
 		/etc/ypxfrd
 		sleep 5
 		/etc/yp/ypset `hostname` > /dev/null
 	fi
 
	if [ -x /etc/yp/yp_first ] 
	then
		echo " yp_first\c"
		echo ""
		/etc/yp/yp_first
		mv /etc/yp/yp_first /etc/yp/first_done
	fi

 	echo ""
# SCO_NISRT
.
w
q
EOF
	elif [ $copierp = T -a $nis_exists -eq 0 ]
	then
	ed - /etc/nfs << EOF
/^USAGE/a
# SCO_NISRT
YPDOMAIN="$def_dom"
# SCO_NISRT
.
w
q
EOF
	ed - /etc/nfs << EOF > /dev/null
50,90s/#domainname/domainname/
.
w
q
EOF
		ed - /etc/nfs << EOF
/^# Add additional SERVICES here/a
# SCO_NISRT

	echo "NIS services:\c"

	echo " ypserv\c"
	if [ -f /etc/resolv.conf -o -f /etc/named.boot ] ; then
		ypserv -d -localonly
	else
		ypserv -localonly
	fi

	echo " ypbind\c"
	ypbind $YPBIND_OPTION

#	echo " yppasswdd\c"
#	yppasswdd /etc/passwd.yp -m passwd SILENT=1

 	if [ -n "\$YPDOMAIN" -a -d /etc/yp/\$YPDOMAIN ]
 	then
 		echo " ypxfrd\c"
 		/etc/ypxfrd
 		sleep 5
 		/etc/yp/ypset `hostname` > /dev/null
 	fi
 
	if [ -x /etc/yp/yp_first ] 
	then
		echo " yp_first\c"
		echo ""
		/etc/yp/yp_first
		mv /etc/yp/yp_first /etc/yp/first_done
	fi

	echo ""
# SCO_NISRT
.
w
q
EOF
	fi

# we now need to edit /etc/yp/yp_first to give it a master name
# so that it knows which host to request the map xfrs from
#

		ed - /etc/yp/yp_first << EOF
	/^def_dom/a
master="$master"
.
w
q
EOF

	check_conf

	echo ""
	echo "${host}'s NIS data base has been set up\c"
	if [ $errors_in_setup = T ]
	then
		echo " with errors.  Please remember"
		echo "to figure out what went wrong, and fix it."
	else
		echo " without any errors."
		> /etc/yp/ypinit_done
	fi
	
	exit 0
else

	rm -f $yproot_dir/*.time

	while [ $got_host_list = F ]; do
		echo $host >$hf
		tput clear
		echo "\n"
		echo "\
At this point, we have to construct a list of the hosts which will be running "
		echo "\
NIS (yp server hosts).  The local host is in this list of yp server hosts."
		echo "Please continue to add the names for the other hosts, one per line."
		echo "When you are done with the list, type a <ctl D>."
		echo "	next host to add:  $host"
		echo "	next host to add:  \c"

		while read h
		do
			echo "	next host to add:  \c"
			echo $h >>$hf
		done

		echo ""
		echo "The current list of yp servers looks like this:"
		echo ""

		cat $hf
		echo ""
		echo "Is this correct?  [y/n/q: y]  \c"
		read hlist_ok

		case $hlist_ok in
		n*)	got_host_list=F
			echo "Let's try the whole thing again...";;
		N*)	got_host_list=F
			echo "Let's try the whole thing again...";;

		q)	error_exit;;

		*)	got_host_list=T;;
		esac
	done

	tput clear
	echo "\n"
	echo "\
There will be no further questions. The remainder of the procedure should take"
	echo "5 to 10 minutes."

 # 
 # with the new ypinit, we do all the work at the end of the script, rather 
 # than when each question is answered.  If we got this far, that means that
 # all questions were answered affirmatively, and we can make the following
 # file modifications.
 #

nis_backup

 # link /bin/passwd to /bin/yppasswd
	/bin/rm /bin/yppasswd > /dev/dull
	/bin/ln /bin/passwd /bin/yppasswd 

# set up /etc/passwd.yp
if [ ! -f /etc/passwd.yp ] ; then
	/etc/yp/ypshad2pwd /etc/passwd /etc/shadow /etc/passwd.yp
fi

 # set up passwd.local
if [ ! -f /etc/passwd.local ] ; then
	/bin/cp /etc/passwd /etc/passwd.local
fi

# set up /etc/group.yp
if [ ! -f /etc/group.yp ] ;
  then
	/bin/cp /etc/group /etc/group.yp
fi

 # set up group.local
if [ ! -f /etc/group.local ] ;
  then
	/bin/cp /etc/group /etc/group.local
fi

# 
# build ypservers database and do a yp make
#

	echo "Building $yproot_dir/$def_dom/ypservers..."
	$yproot_dir/makedbm $hf $yproot_dir/$def_dom/ypservers

	if [ $?  -ne 0 ]
	then
		log "\
Couldn't build yp data base $yproot_dir/ypservers."
		errors_in_setup=T

		error_exit
	fi

	rm $hf

	in_pwd=`pwd`
	cd $yproot_dir
	echo "Running $yproot_dir/ypmake..."
	/etc/yp/ypmake NOPUSH=1 

	bad=$?
	if [ $bad -ne 0 ]
	then
		log "\
Error running Makefile."
		log "\
return code is $bad"
		log "\
Please correct the problem and run 'ypmake NOPUSH=1' in the directory /etc/yp."
	fi

	if [ $masterp = T -a $nis_exists -eq 0 ] ; then
	ed - /etc/nfs << EOF
/^USAGE/a
# SCO_NISRT
YPDOMAIN="$def_dom"
# SCO_NISRT
.
w
q
EOF
	ed - /etc/nfs << EOF > /dev/null
50,90s/#domainname/domainname/
.
w
q
EOF
		ed - /etc/nfs << EOF
/^# Add additional SERVICES here/a
# SCO_NISRT

	echo "NIS services:\c"

	echo " ypserv\c"
	if [ -f /etc/resolv.conf -o -f /etc/named.boot ] ; then
		ypserv -d
	else
		ypserv
	fi

	echo " ypbind\c"
	ypbind $YPBIND_OPTION

	echo " yppasswdd\c"
	yppasswdd /etc/passwd.yp -m passwd SILENT=1

 	if [ -n "\$YPDOMAIN" -a -d /etc/yp/\$YPDOMAIN ]
 	then
 		echo " ypxfrd\c"
 		/etc/ypxfrd
 		sleep 5
 		/etc/yp/ypset `hostname` > /dev/null
 	fi
 
	echo ""

# SCO_NISRT
.
w
q
EOF
	fi

	check_conf

	cd $in_pwd
	echo ""
	echo "\
$host has been set up as a yp master server\c"

	if [ $errors_in_setup = T ]
	then
		echo " with errors.  Please remember"
		echo "to figure out what went wrong, and fix it."
	else
		echo " without any errors."
		> /etc/yp/ypinit_done
	fi

	echo ""
	echo "\
If there are running slave yp servers, run yppush now for any data bases"
	echo "\
which have been changed.  If there are no running slaves, run ypinit on"
	echo "\
those hosts which are to be slave servers."
fi
