Added man page, support for amd.home and ypservers.
authormaja <maja@openbsd.org>
Sun, 20 Apr 1997 10:00:19 +0000 (10:00 +0000)
committermaja <maja@openbsd.org>
Sun, 20 Apr 1997 10:00:19 +0000 (10:00 +0000)
Integrated some code from ypinit in NetBSD (thorpej@netbsd.org).

usr.sbin/ypserv/ypinit/Makefile
usr.sbin/ypserv/ypinit/Makefile.main
usr.sbin/ypserv/ypinit/Makefile.yp
usr.sbin/ypserv/ypinit/README [new file with mode: 0644]
usr.sbin/ypserv/ypinit/ypinit.8 [new file with mode: 0644]
usr.sbin/ypserv/ypinit/ypinit.sh

index a3eb807..2e77c95 100644 (file)
@@ -1,13 +1,26 @@
-#      $OpenBSD: Makefile,v 1.9 1996/12/08 15:00:08 downsj Exp $
+#      $OpenBSD: Makefile,v 1.10 1997/04/20 10:00:19 maja Exp $
 
-NOOBJ= noobj
+MAN=   ypinit.8
+
+DISTFILES= Makefile.main Makefile.yp
+SHFILES= ypinit.sh
 
 install:
+.for script in ${SHFILES}
        ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
-           ${.CURDIR}/ypinit.sh ${DESTDIR}/usr/sbin/ypinit
+           ${.CURDIR}/${script} ${DESTDIR}${BINDIR}/${script:R}
+.endfor
+.for script in ${DISTFILES}
        ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
-           ${.CURDIR}/Makefile.yp ${DESTDIR}/var/yp/Makefile.yp
+           ${.CURDIR}/${script} ${DESTDIR}/var/yp/${script}.dist
+.endfor
+       ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \
+           ${.CURDIR}/README ${DESTDIR}/var/yp/README
+
+distribution:
+.for script in ${DISTFILES}
        ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
-           ${.CURDIR}/Makefile.main ${DESTDIR}/var/yp/Makefile.main
+           ${.CURDIR}/${script} ${DESTDIR}/var/yp/${script}
+.endfor
 
 .include <bsd.prog.mk>
index ca1e926..5f50bbb 100644 (file)
@@ -1,7 +1,7 @@
-#      $OpenBSD: Makefile.main,v 1.6 1997/04/15 22:58:58 maja Exp $
+#      $OpenBSD: Makefile.main,v 1.7 1997/04/20 10:00:21 maja Exp $
 
 SUBDIR=        
 
-passwd group hosts ethers networks rpc services protocols netid netgroup: _SUBDIRUSE
+passwd group hosts ethers networks rpc services protocols netid netgroup amd.home : _SUBDIRUSE
 
 .include <bsd.subdir.mk>
index 07d5f85..bd009c9 100644 (file)
@@ -1,7 +1,8 @@
-#      $OpenBSD: Makefile.yp,v 1.7 1997/04/15 22:58:59 maja Exp $
+#      $OpenBSD: Makefile.yp,v 1.8 1997/04/20 10:00:22 maja Exp $
 
 YPDBDIR=/var/yp
 DIR=/etc
+AMDDIR=/etc/amd
 NOPUSH=""
 #
 AWK=/usr/bin/awk
@@ -25,7 +26,7 @@ YPPUSH=/usr/sbin/yppush
 MAKEDBM-S=$(MAKEDBM) -s
 UNSECURE="True"
 
-all: passwd group hosts ethers networks rpc services protocols netid netgroup
+all: passwd group hosts ethers networks rpc services protocols netid netgroup amd.home
 
 passwd.time: $(DIR)/master.passwd
        -@if [ -f $(>) ]; then \
@@ -241,6 +242,35 @@ netgroup.time: $(DIR)/netgroup
        fi
 
 
+amd.home.time: $(AMDDIR)/amd.home
+       -@if [ -f $(>) ]; then \
+               $(SED) -e "s/#.*$$//" -e "/^$$/d" $(>) | \
+               $(AWK) '{ \
+                           for (i = 1; i <= NF; i++) \
+                               if (i == NF) { \
+                                   if (substr($$i, length($$i), 1) == "\\") { \
+                                       printf("%s", substr($$i, 1, length($$i) - 1)); \
+                                   } \
+                                   else \
+                                       printf("%s\n", $$i); \
+                               } \
+                               else \
+                                   printf("%s ", $$i); \
+                       }' | \
+               $(MAKEDBM) - amd.home; \
+               $(TOUCH) $(@); \
+               $(ECHO) "updated amd.home"; \
+               if [ ! $(NOPUSH) ]; then \
+                       $(YPPUSH) -d $(DOMAIN) amd.home; \
+                       $(ECHO) "pushed amd.home"; \
+               else \
+                       : ; \
+               fi \
+       else \
+               $(ECHO) "couldn't find $(>)"; \
+       fi
+
+
 passwd: passwd.time
 group: group.time
 hosts: hosts.time
@@ -251,6 +281,7 @@ services: services.time
 protocols: protocols.time
 netid: netid.time
 netgroup: netgroup.time
+amd.home: amd.home.time
 $(DIR)/passwd:
 $(DIR)/group:
 $(DIR)/hosts:
@@ -262,4 +293,4 @@ $(DIR)/protocols:
 $(DIR)/netid:
 $(DIR)/master.passwd:
 $(DIR)/netgroup:
-
+$(AMDDIR)/amd.home:
diff --git a/usr.sbin/ypserv/ypinit/README b/usr.sbin/ypserv/ypinit/README
new file mode 100644 (file)
index 0000000..b9d7a1e
--- /dev/null
@@ -0,0 +1,10 @@
+ $OpenBSD: README,v 1.1 1997/04/20 10:00:24 maja Exp $
+
+The files Makefile.yp.dist and Makefile.main.dist should NEVER be changed,
+they will be overwritten by eg make build.
+
+Local changes can be done in Makefile.yp and Makefile.main. They are replace
+by make in /usr/src/etc which normaly isn't done.
+
+-moj
+
diff --git a/usr.sbin/ypserv/ypinit/ypinit.8 b/usr.sbin/ypserv/ypinit/ypinit.8
new file mode 100644 (file)
index 0000000..b369db3
--- /dev/null
@@ -0,0 +1,69 @@
+.\"    $OpenBSD: ypinit.8,v 1.1 1997/04/20 10:00:25 maja Exp $
+.\" Copyright (c) 1997 Mats O Jansson <moj@stacken.kth.se>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"    This product includes software developed by Mats O Jansson
+.\" 4. The name of the author may not be used to endorse or promote products
+.\"    derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd April 19, 1997
+.Dt YPINIT 8
+.Os
+.Sh NAME
+.Nm ypinit
+.Nd create an YP server (master or slave)
+.Sh SYNOPSIS
+.Nm ypinit
+.Fl m Op Ar domainname
+.Nm ypinit
+.Fl s Ar master_server Op Ar domainname
+.Nm ypinit
+.Fl u Op Ar domainname
+.Sh DESCRIPTION
+.Nm Ypinit
+is the utiliy to setup an YP server, or changing the ypserver map.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl m
+Setup a master YP server. If 
+.Ar domainname
+is not given the default domainname will be used.
+.It Fl s
+Setup a slave YP server.
+.Ar domainname
+is not given the default domainname will be used.
+.Ar master_server
+must be a running YP master server.
+.It Fl u
+Update the ypserver map on a YP master server. If 
+.Ar domainname
+is not given the default domainname will be used.
+.El
+.Sh SEE ALSO
+.Xr yp 8 ,
+.Xr ypserv 8 
+.Sh AUTHOR
+Mats O Jansson <moj@stacken.kth.se>
index b5d6733..742ac6b 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/sh
-#      $Id: ypinit.sh,v 1.3 1996/03/02 03:01:40 dm Exp $
+#      $Id: ypinit.sh,v 1.4 1997/04/20 10:00:27 maja Exp $
 #
 # ypinit.sh - setup an master or slave server.
 #
@@ -8,6 +8,8 @@ HOSTNAME=/bin/hostname
 YPWHICH=/usr/bin/ypwhich
 YPXFR=/usr/sbin/ypxfr
 YP_DIR=/var/yp
+MAKEDBM=/usr/sbin/makedbm
+ERROR_EXISTS="NO"
 
 #set -xv
 
@@ -21,6 +23,13 @@ then
                SERVERTYPE=MASTER
                ERROR=
        fi
+
+       if [ $1 = "-u" ]                # ypinit -u
+       then
+               DOMAIN=`${DOMAINNAME}`
+               SERVERTYPE=UPDATE
+               ERROR=
+       fi
 fi
 
 if [ $# -eq 2 ]
@@ -31,6 +40,7 @@ then
                SERVERTYPE=MASTER
                ERROR=
        fi
+
        if [ $1 = "-s" ]                # ypinit -s master_server
        then
                DOMAIN=`${DOMAINNAME}`
@@ -38,6 +48,13 @@ then
                MASTER=${2}
                ERROR=
        fi
+
+       if [ $1 = "-u" ]                # ypinit -u domainname
+       then
+               DOMAIN=${2}
+               SERVERTYPE=UPDATE
+               ERROR=
+       fi
 fi
 
 if [ $# -eq 3 ]
@@ -51,33 +68,57 @@ then
        fi
 fi
 
-if [ "${ERROR}" = "USAGE" ]
-then
-       echo "usage: ypinit -m [domainname]" 1>&2
-       echo "       ypinit -s master_server [domainname]" 1>&2
-       echo "" 1>&2
-       echo "\
-where -m is used to build a master YP server data base, and -s is used for" 1>&2
-       echo "\
-a slave data base.  master_server must be an existing reachable YP server." 1>&2
+if [ "${ERROR}" = "USAGE" ]; then
+       cat << \__usage 1>&2
+usage: ypinit -m [domainname]
+       ypinit -s master_server [domainname]
+       ypinit -u [domainname]
+
+The `-m' flag builds a master YP server, and the `-s' flag builds
+a slave YP server.  When building a slave YP server, `master_server'
+must be an existing, reachable YP server.
+The `-u' is for updating the ypservers map on a master server.
+__usage
+
        exit 1
 fi
 
 # Check if domainname is set, don't accept an empty domainname
+if [ -z "${DOMAIN}" ]; then
+       cat << \__no_domain 1>&2
+The local host's YP domain name has not been set.  Please set it with
+the domainname(8) command or pass the domain as an argument to ypinit(8).
+__no_domain
 
-if [ -z "${DOMAIN}" ]
-then
-       echo "\aThe local host's domain name hasn't been set. Please set it." 1>&2
        exit 1
 fi
 
 # Check if hostname is set, don't accept an empty hostname
-
 HOST=`${HOSTNAME}`
+if [ -z "${HOST}" ]; then
+       cat << \__no_hostname 1>&2
+The local host's hostname has not been set.  Please set it with the
+hostname(8) command.
+__no_hostname
+
+       exit 1
+fi
 
-if [ -z "${HOST}" ]
+# Check if we have contact with master.
+if [ "${SERVERTYPE}" = "SLAVE" ];
 then
-       echo "\aThe local host's name hasn't been set. Please set it." 1>&2
+       COUNT=`${YPWHICH} -d ${DOMAIN} -m 2>/dev/null | grep -i "${MASTER} | wc -l | tr -d " "`
+       if [ "$COUNT" = "0" ]
+       then
+               echo "Can't enumerate maps from ${MASTER}. Please check that it is running." 1>&2
+               exit 1
+       fi
+fi
+
+# Check if user is root
+ID=`id -u`
+if [ "${ID}" != "0" ]; then
+       echo "You have to be the superuser to run this.  Please login as root." 1>&2
        exit 1
 fi
 
@@ -85,55 +126,72 @@ fi
 
 if [ ! -d ${YP_DIR} -o -f ${YP_DIR} ]
 then
-       echo "\aThe directory ${YP_DIR} doesn't exist. Restore it from the distribution." 1>&2
-       echo "(Or move ${YP_DIR}.no to ${YP_DIR} if YP has not been activated before." 1>&2
+       echo "The directory ${YP_DIR} doesn't exist.  Restore it from the distribution." 1>&2
        exit 1
 
 fi
 
-#echo "Server Type: ${SERVERTYPE} Domain: ${DOMAIN} Master: ${MASTER}"
-
-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 -n "Server Type: ${SERVERTYPE} Domain: ${DOMAIN}"
+if [ "${SERVERTYPE}" = "SLAVE" ]; then
+       echo -n " Master: ${MASTER}"
+fi
 echo ""
 
-if [ -d ${YP_DIR}/${DOMAIN} ]; then
-       
-       echo -n "Can we destroy the existing ${YP_DIR}/${DOMAIN} and its contents? [y/n: n]  "
-       read KILL
-
-       ERROR=
-       case ${KILL} in
-       y*)     ERROR=DELETE;;
-       Y*)     ERROR=DELETE;;
-       *)      ERROR=;;
+if [ "${SERVERTYPE}" != "UPDATE" ];
+then
+       cat << \__notice1
+
+Creating an YP server will require that you answer a few questions.
+Questions will all be asked at the beginning of the procedure.
+
+__notice1
+
+       echo -n "Do you want this procedure to quit on non-fatal errors? [y/n: n]  "
+       read DOEXIT
+
+       case ${DOEXIT} in
+       y*|Y*)
+               ERROR_EXIT="YES"
+               ;;
+
+       *)      ERROR_EXIT="NO"
+               echo ""
+               echo "Ok, please remember to go back and redo manually whatever fails."
+               echo "If you don't, something might not work. "
+               ;;
        esac
 
-       if [ -z "${ERROR}" ]
-       then
-               echo "OK, please clean it up by hand and start again.  Bye"
-               exit 0
-       fi
+       if [ -d "${YP_DIR}/${DOMAIN}" ]; then
+               echo "" 
+               echo -n "Can we destroy the existing ${YP_DIR}/${DOMAIN} and its contents? [y/n: n]  "
+               read KILL
 
-       if [ "${ERROR}" = "DELETE" ]
-       then
-               rm -r -f ${YP_DIR}/${DOMAIN}
-               
-               if [ $?  -ne 0 ]
-               then
-                       echo "\aCan't clean up old directory ${YP_DIR}/${DOMAIN}.  Fatal error." 1>&2
-                       exit 1
+               ERROR=
+               case ${KILL} in
+               y*|Y*)
+                       ERROR="DELETE"
+                       ;;
+
+               *)      ERROR=
+                       ;;
+               esac
+
+               if [ "${ERROR}" = "DELETE" ]; then
+                       if ! rm -rf ${YP_DIR}/${DOMAIN}; then
+                               echo "Can't clean up old directory ${YP_DIR}/${DOMAIN}." 1>&2
+                               exit 1
+                       fi
+               else
+                       echo "OK, please clean it up by hand and start again.  Bye"
+                       exit 0
                fi
+       
        fi
 
-fi
-
-mkdir ${YP_DIR}/${DOMAIN}
-
-if [ $?  -ne 0 ]
-then
-       echo "\aCan't make new directory ${YP_DIR}/${DOMAIN}.  Fatal error." 1>&2
-       exit 1
+       if ! mkdir "${YP_DIR}/${DOMAIN}"; then
+               echo "Can't make new directory ${YP_DIR}/${DOMAIN}." 1>&2
+               exit 1
+       fi
 fi
 
 if [ "${SERVERTYPE}" = "MASTER" ];
@@ -143,7 +201,7 @@ then
        then
                if [ ! -f ${YP_DIR}/Makefile.main ]
                then
-                       echo "\aCan't find ${YP_DIR}/Makefile.main. " 1>&2
+                       echo "Can't find ${YP_DIR}/Makefile.main. " 1>&2
                        exit 1
                fi
                cp ${YP_DIR}/Makefile.main ${YP_DIR}/Makefile
@@ -153,32 +211,29 @@ then
        
        if [ -z "${SUBDIR}" ]
        then
-               echo "\aCan't find line starting with 'SUBDIR=' in ${YP_DIR}/Makefile. " 1>&2
+               echo "Can't find line starting with 'SUBDIR=' in ${YP_DIR}/Makefile. " 1>&2
                exit 1
        fi
 
        NEWSUBDIR="SUBDIR="
-       for DIR in `echo ${SUBDIR} | cut -c8-255`
-       do
-               if [ ${DIR} != ${DOMAIN} ]
-               then
+       for DIR in `echo ${SUBDIR} | cut -c8-255`; do
+               if [ ${DIR} != ${DOMAIN} ]; then
                        NEWSUBDIR="${NEWSUBDIR} ${DIR}"
                fi
        done
        NEWSUBDIR="${NEWSUBDIR} ${DOMAIN}"
 
-       if [ -f ${YP_DIR}/Makefile.tmp ]
-       then 
+       if [ -f ${YP_DIR}/Makefile.tmp ]; then 
                rm ${YP_DIR}/Makefile.tmp
        fi
 
        mv ${YP_DIR}/Makefile ${YP_DIR}/Makefile.tmp
-       sed -e "s/^${SUBDIR}/${NEWSUBDIR}/" ${YP_DIR}/Makefile.tmp > ${YP_DIR}/Makefile
+       sed -e "s/^${SUBDIR}/${NEWSUBDIR}/" ${YP_DIR}/Makefile.tmp > \
+           ${YP_DIR}/Makefile
        rm ${YP_DIR}/Makefile.tmp
 
-       if [ ! -f ${YP_DIR}/Makefile.yp ]
-       then
-               echo "\aCan't find ${YP_DIR}/Makefile.yp. " 1>&2
+       if [ ! -f ${YP_DIR}/Makefile.yp ]; then
+               echo "Can't find ${YP_DIR}/Makefile.yp. " 1>&2
                exit 1
        fi
 
@@ -189,21 +244,157 @@ fi
 if [ "${SERVERTYPE}" = "SLAVE" ];
 then
 
-       echo ""
+       echo "There will be no further questions. The remainder of the procedure"
+       echo "should take a few minutes, to copy the databases from ${MASTER}."
 
        for MAP in `${YPWHICH} -d ${DOMAIN} -m | cut -d\  -f1`
        do
                echo "Transfering ${MAP}..."
-               ${YPXFR} -h ${MASTER} -c -d ${DOMAIN} ${MAP}
-
-               if [ $?  -ne 0 ]
-               then
-                       echo "\aCan't transfer map ${MAP}." 1>&2
-                       exit 1
+               if ! ${YPXFR} -h ${MASTER} -c -d ${DOMAIN} ${MAP}; then
+                       echo "Can't transfer map ${MAP}." 1>&2
+                       ERROR_EXISTS="YES"
+                       if [ "${ERROR_EXIT}" = "YES" ]; then
+                               exit 1
+                       fi
                fi
        done
 
        echo ""
+       if [ "${ERROR_EXISTS}" = "YES"  ]; then
+               echo "${HOST} has been setup as an YP slave server with errors. " 1>&2
+               echo "Please remember fix any problem that occurred." 1>&2
+       else
+               echo "${HOST} has been setup as an YP slave server without any errors. "
+       fi
+
        echo "Don't forget to update map ypservers on ${MASTER}."
        exit 0
 fi
+
+LIST_OK="NO"
+
+while [ "${LIST_OK}" = "NO" ];
+do
+       
+       if [ "${SERVERTYPE}" = "MASTER" ];
+       then
+               HOST_LIST="${HOST}"
+               echo ""
+               echo "At this point, we have to construct a list of this domains YP servers."
+               echo "${HOST} is already known as master server."
+               echo "Please continue to add any slave servers, one per line. When you are"
+               echo "done with the list, type a <control D>."
+               echo "  master server   :  ${HOST}"
+       fi
+
+       if [ "${SERVERTYPE}" = "UPDATE" ];
+       then
+               HOST_LIST="${HOST}"
+               NEW_LIST=""
+               MASTER_NAME=""
+               SHORT_HOST=`echo ${HOST} | cut -d. -f1`
+               if [ -f ${YP_DIR}/${DOMAIN}/ypservers.db ];
+               then
+                       for srv in `${MAKEDBM} -u ${YP_DIR}/${DOMAIN}/ypservers | grep -v "^YP" | tr "\t" " " | cut -d\  -f1`;
+                       do
+                               short_srv=`echo ${srv} | cut -d. -f1`
+                               if [ "${SHORT_HOST}" != "${short_srv}" ]
+                               then
+                                       if [ "${NEW_LIST}" = "" ];
+                                       then
+                                               NEW_LIST="${srv}"
+                                       else
+                                               NEW_LIST="${NEW_LIST} ${srv}"
+                                       fi
+                               fi
+                       done;
+                       MASTER_NAME=`${MAKEDBM} -u ${YP_DIR}/${DOMAIN}/ypservers | grep "^YP_MASTER_NAME" | tr "\t" " " | cut -d\  -f2`
+               fi
+               echo ""
+               echo "Update the list of hosts running YP servers in domain ${DOMAIN}."
+               echo "Master for this domain is ${MASTER_NAME}."
+               echo ""
+               echo "First verify old servers, type \\ to remove a server." 
+               echo "Then add new servers, one per line. When done type a <control D>." 
+               echo ""
+               echo "  master server   :  ${HOST}"
+               if [ "${NEW_LIST}" != "" ]; then
+                       for node in $NEW_LIST; do
+                               echo -n "       verify host     : [${node}] "
+                               read verify
+                               if [ "${verify}" != "\\" ]; then
+                                       HOST_LIST="${HOST_LIST} ${node}"
+                               fi
+                       done;
+               fi
+       fi
+
+       echo -n "       next host to add:  "
+
+       while read h
+       do
+               echo -n "       next host to add:  "
+               HOST_LIST="${HOST_LIST} ${h}"
+       done
+
+       echo ""
+       echo "The current list of NIS servers looks like this:"
+       echo ""
+
+       for h in `echo ${HOST_LIST}`;
+       do
+               echo ${h}
+       done
+
+       echo ""
+       echo -n "Is this correct?  [y/n: y]  "
+       read hlist_ok
+
+       case $hlist_ok in
+       n*)     echo "Let's try the whole thing again...";;
+       N*)     echo "Let's try the whole thing again...";;
+       *)      LIST_OK="YES";;
+       esac
+
+done
+
+echo "Building ${YP_DIR}/${DOMAIN}/ypservers..."
+for host in ${HOST_LIST};
+do
+       echo "${host} ${host}"
+done | ${MAKEDBM} - ${YP_DIR}/${DOMAIN}/ypservers
+
+if [ $? -ne 0 ]; then
+       echo "" 1>&2
+       echo "Couldn't build yp data base ${YP_DIR}/${DOMAIN}/ypservers." 1>&2
+       ERROR_EXISTS="YES"
+       if [ "${ERROR_EXIT}" = "YES" ]; then 
+               exit 1
+       fi
+fi
+
+if [ "${SERVERTYPE}" = "MASTER" ]; then
+       
+       CUR_PWD=`pwd`
+       cd ${YP_DIR}/${DOMAIN}
+       echo "Running ${YP_DIR}/${DOMAIN}/Makefile..."
+       if ! make NOPUSH=1; then
+               echo "" 1>&2
+               echo "Error running Makefile." 1>&2
+               ERROR_EXISTS="YES"
+               if [ "${ERROR_EXIT}" = "YES" ]; then 
+                       exit 1
+               fi
+       fi
+
+       cd ${CUR_PWD}
+
+       echo ""
+       if [ "${ERROR_EXISTS}" = "YES" ]; then
+               echo "${HOST} has been setup as an YP master server with errors. " 1>&2
+               echo "Please remember fix any problem that occurred." 1>&2
+       else
+               echo "${HOST} has been setup as an YP master server without any errors. "
+       fi
+
+fi
\ No newline at end of file