Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/usr.sbin/ypserv/ypinit Pull up following revision(s) (req...



details:   https://anonhg.NetBSD.org/src/rev/cd0591b5f105
branches:  netbsd-8
changeset: 324941:cd0591b5f105
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jul 27 10:52:04 2018 +0000

description:
Pull up following revision(s) (requested by kre in ticket #943):

        usr.sbin/ypserv/ypinit/ypinit.sh: revision 1.13

PR bin/53458

Bring this script a little up to date - make it work with modern /bin/sh
(avoid HOSTNAME as a random variable) clean up trailing spaces on lines,
use $( ) instead of `` ...

diffstat:

 usr.sbin/ypserv/ypinit/ypinit.sh |  30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diffs (107 lines):

diff -r 2670159c13d8 -r cd0591b5f105 usr.sbin/ypserv/ypinit/ypinit.sh
--- a/usr.sbin/ypserv/ypinit/ypinit.sh  Fri Jul 27 10:49:48 2018 +0000
+++ b/usr.sbin/ypserv/ypinit/ypinit.sh  Fri Jul 27 10:52:04 2018 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $NetBSD: ypinit.sh,v 1.12 2004/10/05 11:35:35 tron Exp $
+#      $NetBSD: ypinit.sh,v 1.12.82.1 2018/07/27 10:52:04 martin Exp $
 #
 # ypinit.sh - setup a master or slave YP server
 #
@@ -10,27 +10,27 @@
 #
 
 PATH=/bin:/usr/sbin:/usr/bin:${PATH}
-DOMAINNAME=/bin/domainname
-HOSTNAME=/bin/hostname
+BIN_DOMAINNAME=/bin/domainname
+BIN_HOSTNAME=/bin/hostname
 ID=/usr/bin/id
 INSTALL=/usr/bin/install
 MAKEDBM=/usr/sbin/makedbm
 YPWHICH=/usr/bin/ypwhich
 YPXFR=/usr/sbin/ypxfr
 
-progname=`basename $0`
+progname=$( basename $0 )
 yp_dir=/var/yp
-tmpfile=`mktemp /tmp/ypservers.XXXXXX` || exit 1
+tmpfile=$(mktemp /tmp/ypservers.XXXXXX) || exit 1
 trap "rm -f ${tmpfile} ; exit 0" EXIT INT QUIT
 
 umask 077                              # protect created directories
 
-if [ `${ID} -u` != 0 ]; then
+if [ $( ${ID} -u ) != 0 ]; then
        echo 1>&2 "$progname: you must be root to run this"
        exit 1
 fi
 
-args=`getopt cl:ms: $*`
+args=$(getopt cl:ms: $*)               # XXX should switch to getopts
 if [ $? -eq 0 ]; then
        set -- $args
        for i; do
@@ -66,12 +66,12 @@
                domain=${1}
                shift;
        else
-               domain=`${DOMAINNAME}`
+               domain=$( ${BIN_DOMAINNAME} )
        fi
 fi
 
 if [ -z ${servertype} ]; then
-       cat 1>&2 << __usage 
+       cat 1>&2 << __usage
 usage:         ${progname} -c [domainname] [-l server1,...,serverN]
        ${progname} -m [domainname] [-l server1,...,serverN]
        ${progname} -s master_server [domainname] [-l server1,...,serverN]
@@ -95,7 +95,7 @@
 fi
 
 # Check if hostname is set, don't accept an empty hostname
-host=`${HOSTNAME}`
+host=$( ${BIN_HOSTNAME} )
 if [ -z "${host}" ]; then
        cat 1>&2 << __no_hostname
 $progname: The local host's hostname has not been set.
@@ -258,7 +258,7 @@
                cp ${yp_dir}/Makefile.main ${yp_dir}/Makefile
        fi
 
-       subdir=`grep "^SUBDIR=" ${yp_dir}/Makefile`
+       subdir=$(grep "^SUBDIR=" ${yp_dir}/Makefile)
 
        if [ -z "${subdir}" ]; then
                echo 1>&2 \
@@ -267,14 +267,14 @@
        fi
 
        newsubdir="SUBDIR="
-       for dir in `echo ${subdir} | cut -c8-255`; do
+       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
 
@@ -305,9 +305,9 @@
 slave)
        echo ""
 
-       maps=`${YPWHICH} -d ${domain} -h ${master} -f -m 2>/dev/null | \
+       maps=$( ${YPWHICH} -d ${domain} -h ${master} -f -m 2>/dev/null |
            awk '{ if (substr($2, 1, length("'$master'")) == "'$master'") \
-               print $1; }'`
+               print $1; }' )
 
        if [ -z "${maps}" ]; then
                cat 1>&2 << __no_maps



Home | Main Index | Thread Index | Old Index