Add a -l argument to ypinit that allows adding servers in the format
server1,server2,server3 on the command line. This allows the user to optionally avoid the interactive mode of ypinit. If the -l flag is not supplied, the old behavior is retained. This allows users to do things like rsh out creation of YP clients, and sushi to generate yp clients/servers/slaves.
This commit is contained in:
parent
1b56a92cf9
commit
3815ce799a
@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: ypinit.8,v 1.7 1999/03/07 11:58:26 mycroft Exp $
|
.\" $NetBSD: ypinit.8,v 1.8 2001/08/01 07:01:03 garbled Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
|
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
@ -34,7 +34,7 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd January 4, 1997
|
.Dd July 31, 2001
|
||||||
.Dt YPINIT 8
|
.Dt YPINIT 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -44,13 +44,16 @@
|
|||||||
.Nm ""
|
.Nm ""
|
||||||
.Fl c
|
.Fl c
|
||||||
.Op Ar domainname
|
.Op Ar domainname
|
||||||
|
.Op Fl l Ar server1,...,serverN
|
||||||
.Nm ""
|
.Nm ""
|
||||||
.Fl m
|
.Fl m
|
||||||
.Op Ar domainname
|
.Op Ar domainname
|
||||||
|
.Op Fl l Ar server1,...,serverN
|
||||||
.Nm ""
|
.Nm ""
|
||||||
.Fl s
|
.Fl s
|
||||||
.Ar master_server
|
.Ar master_server
|
||||||
.Op Ar domainname
|
.Op Ar domainname
|
||||||
|
.Op Fl l Ar server1,...,serverN
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
initialises the files and directories that are required for a
|
initialises the files and directories that are required for a
|
||||||
@ -74,6 +77,10 @@ Initialises
|
|||||||
to contain a list of ypservers for
|
to contain a list of ypservers for
|
||||||
.Xr ypbind 8
|
.Xr ypbind 8
|
||||||
to connect to.
|
to connect to.
|
||||||
|
.It Fl l Ar server1,...,serverN
|
||||||
|
Set the list of client servers from the command line rather than
|
||||||
|
prompting for them interactively. The format is a comma separated list
|
||||||
|
of server names with no spaces.
|
||||||
.It Fl m
|
.It Fl m
|
||||||
Create a master
|
Create a master
|
||||||
.Tn YP
|
.Tn YP
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# $NetBSD: ypinit.sh,v 1.9 2001/06/18 11:21:54 lukem Exp $
|
# $NetBSD: ypinit.sh,v 1.10 2001/08/01 07:01:03 garbled Exp $
|
||||||
#
|
#
|
||||||
# ypinit.sh - setup a master or slave YP server
|
# ypinit.sh - setup a master or slave YP server
|
||||||
#
|
#
|
||||||
@ -30,7 +30,7 @@ if [ `${ID} -u` != 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
args=`getopt cms: $*`
|
args=`getopt cl:ms: $*`
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
set -- $args
|
set -- $args
|
||||||
for i; do
|
for i; do
|
||||||
@ -49,6 +49,12 @@ if [ $? -eq 0 ]; then
|
|||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
"-l")
|
||||||
|
noninteractive=yes
|
||||||
|
serverlist=${2}
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
"--")
|
"--")
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
@ -66,9 +72,9 @@ fi
|
|||||||
|
|
||||||
if [ -z ${servertype} ]; then
|
if [ -z ${servertype} ]; then
|
||||||
cat 1>&2 << __usage
|
cat 1>&2 << __usage
|
||||||
usage: ${progname} -c [domainname]
|
usage: ${progname} -c [domainname] [-l server1,...,serverN]
|
||||||
${progname} -m [domainname]
|
${progname} -m [domainname] [-l server1,...,serverN]
|
||||||
${progname} -s master_server [domainname]
|
${progname} -s master_server [domainname] [-l server1,...,serverN]
|
||||||
|
|
||||||
The \`-c' flag sets up a YP client, the \`-m' flag builds a master YP
|
The \`-c' flag sets up a YP client, the \`-m' flag builds a master YP
|
||||||
server, and the \`-s' flag builds a slave YP server. When building a
|
server, and the \`-s' flag builds a slave YP server. When building a
|
||||||
@ -129,60 +135,74 @@ __no_dir
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat << __client_setup
|
if [ -z "${noninteractive}" ]; then
|
||||||
|
cat << __client_setup
|
||||||
A YP client needs a list of YP servers to bind to.
|
A YP client needs a list of YP servers to bind to.
|
||||||
Whilst ypbind supports -broadcast, its use is not recommended.
|
Whilst ypbind supports -broadcast, its use is not recommended.
|
||||||
__client_setup
|
__client_setup
|
||||||
|
|
||||||
done=
|
done=
|
||||||
while [ -z "${done}" ]; do
|
while [ -z "${done}" ]; do
|
||||||
> ${tmpfile}
|
> ${tmpfile}
|
||||||
cat <<__list_of_servers
|
cat <<__list_of_servers
|
||||||
|
|
||||||
Please enter a list of YP servers, in order of preference.
|
Please enter a list of YP servers, in order of preference.
|
||||||
When finished, press RETURN on a blank line or enter EOF.
|
When finished, press RETURN on a blank line or enter EOF.
|
||||||
|
|
||||||
__list_of_servers
|
__list_of_servers
|
||||||
|
|
||||||
|
if [ "${servertype}" != "client" ]; then
|
||||||
|
echo ${host} >> ${tmpfile}
|
||||||
|
echo " next host: ${host}";
|
||||||
|
fi
|
||||||
|
echo -n " next host: ";
|
||||||
|
|
||||||
|
while read nextserver ; test -n "${nextserver}"
|
||||||
|
do
|
||||||
|
echo ${nextserver} >> ${tmpfile}
|
||||||
|
echo -n " next host: ";
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -s ${tmpfile} ]; then
|
||||||
|
echo ""
|
||||||
|
echo "The current servers are:"
|
||||||
|
echo ""
|
||||||
|
cat ${tmpfile}
|
||||||
|
echo ""
|
||||||
|
echo -n "Is this correct? [y/n: n] "
|
||||||
|
read DONE
|
||||||
|
case ${DONE} in
|
||||||
|
y*|Y*)
|
||||||
|
done=yes
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "You have not supplied any servers."
|
||||||
|
fi
|
||||||
|
if [ -z "${done}" ]; then
|
||||||
|
echo -n "Do you wish to abort? [y/n: n] "
|
||||||
|
read ABORT
|
||||||
|
case ${ABORT} in
|
||||||
|
y*|Y*)
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else # interacive
|
||||||
if [ "${servertype}" != "client" ]; then
|
if [ "${servertype}" != "client" ]; then
|
||||||
echo ${host} >> ${tmpfile}
|
echo ${host} >> ${tmpfile}
|
||||||
echo " next host: ${host}";
|
|
||||||
fi
|
fi
|
||||||
echo -n " next host: ";
|
echo "${serverlist}" | sed -e 's/,/\
|
||||||
|
/g' >> ${tmpfile}
|
||||||
while read nextserver ; test -n "${nextserver}"
|
#the above newline is required
|
||||||
do
|
echo ""
|
||||||
echo ${nextserver} >> ${tmpfile}
|
echo "The current servers are:"
|
||||||
echo -n " next host: ";
|
echo ""
|
||||||
done
|
cat ${tmpfile}
|
||||||
|
echo ""
|
||||||
if [ -s ${tmpfile} ]; then
|
fi # interactive
|
||||||
echo ""
|
|
||||||
echo "The current servers are:"
|
|
||||||
echo ""
|
|
||||||
cat ${tmpfile}
|
|
||||||
echo ""
|
|
||||||
echo -n "Is this correct? [y/n: n] "
|
|
||||||
read DONE
|
|
||||||
case ${DONE} in
|
|
||||||
y*|Y*)
|
|
||||||
done=yes
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "You have not supplied any servers."
|
|
||||||
fi
|
|
||||||
if [ -z "${done}" ]; then
|
|
||||||
echo -n "Do you wish to abort? [y/n: n] "
|
|
||||||
read ABORT
|
|
||||||
case ${ABORT} in
|
|
||||||
y*|Y*)
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -s ${tmpfile} ]; then
|
if [ -s ${tmpfile} ]; then
|
||||||
${INSTALL} -c -m 0444 ${tmpfile} ${binding_dir}/${domain}.ypservers
|
${INSTALL} -c -m 0444 ${tmpfile} ${binding_dir}/${domain}.ypservers
|
||||||
|
Loading…
Reference in New Issue
Block a user