Source-Changes-HG archive

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

[src/netbsd-2]: src/usr.sbin/etcupdate Pull up following revision(s) (request...



details:   https://anonhg.NetBSD.org/src/rev/a403c0d2e573
branches:  netbsd-2
changeset: 564596:a403c0d2e573
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun May 27 21:22:23 2007 +0000

description:
Pull up following revision(s) (requested by martti in ticket #10953):
        usr.sbin/etcupdate/etcupdate: revision 1.31 via patch
        usr.sbin/etcupdate/etcupdate.8: patch
Run pwd_mkdb before running mtree.  Reported by Hauke Fath in PR 35570.
Sync man page with HEAD.

diffstat:

 usr.sbin/etcupdate/etcupdate   |   91 +++++++++++---------
 usr.sbin/etcupdate/etcupdate.8 |  177 ++++++++++++++++++++++++++++++++--------
 2 files changed, 193 insertions(+), 75 deletions(-)

diffs (truncated from 497 to 300 lines):

diff -r c5c68579b13e -r a403c0d2e573 usr.sbin/etcupdate/etcupdate
--- a/usr.sbin/etcupdate/etcupdate      Sun Apr 08 22:27:40 2007 +0000
+++ b/usr.sbin/etcupdate/etcupdate      Sun May 27 21:22:23 2007 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.21.4.1 2007/01/19 21:29:21 bouyer Exp $
+# $NetBSD: etcupdate,v 1.21.4.2 2007/05/27 21:22:23 bouyer Exp $
 #
 # Copyright (c) 2001 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -66,6 +66,7 @@
 BINARYDIR=             # directory name for BINARYDIRMODE
 BINARYTGZMODE=false    # true for "-s etc.tgz"
 TGZLIST=               # colon-separated list for BINARYTGZMODE
+SRC_ARG=               # argument for "-s"
 AUTOMATIC=false
 LOCALSKIP=false
 MACHINE="${MACHINE:=`uname -m`}"
@@ -90,10 +91,11 @@
 
   -p pager     Which pager to use              (default: /usr/bin/more)
   -s {srcdir|tgzfile|tempdir}                  (default: /usr/src)
-               Location of the source files used to populate the
-               target directory.  This may be any of the following:
+               Location of the source files.  This may be any of the
+               following:
                * A directory that contains a NetBSD source tree;
-               * A distribution set file such as "etc.tgz" or "xetc.tgz";
+               * A distribution set file such as "etc.tgz" or
+                 "xetc.tgz", or a colon-separated list of such files;
                * A temporary directory in which one or both of "etc.tgz"
                  and "xetc.tgz" have been extracted.
   -t temproot  Where to store temporary files  (default: /tmp/temproot)
@@ -406,6 +408,7 @@
                BINARYMODE=true
                BINARYDIRMODE=true
                BINARYDIR="${arg}"
+               SRC_ARG="${BINARYDIR}"
                ;;
        -h)
                usage
@@ -425,18 +428,21 @@
                # -s extracted_dir
                arg="${2}"
                shift 2
-               if [ -f "${arg}" ]; then
-                       # arg refers to a *.tgz file.
+               if [ -f "${arg%%:*}" ]; then
+                       # arg refers to a *.tgz file, or a colon-separated
+                       # list.
                        # This may happen twice, for both etc.tgz and
                        # xetc.tgz, so we build up a colon-separated
                        # list in TGZLIST.
                        BINARYMODE=true
                        BINARYTGZMODE=true
                        TGZLIST="${TGZLIST}${TGZLIST:+:}${arg}"
+                       SRC_ARG="${TGZLIST}"
                elif [ -d "${arg}" ] && [ -f "${arg}/etc/Makefile" ]; then
                        # arg refers to a source directory
                        SOURCEMODE=true
                        SRCDIR="${arg}"
+                       SRC_ARG="${SRCDIR}"
                elif [ -d "${arg}" ] && [ -f "${arg}/../etc/Makefile" ]; then
                        # backward compatibility: allow arg to refer to
                        # etc subdirectory within source dir.
@@ -447,6 +453,7 @@
 EOF
                        SOURCEMODE=true
                        SRCDIR="${arg}/.."
+                       SRC_ARG="${SRCDIR}"
                elif [ -d "${arg}" ] && [ -d "${ARG}/etc" ] \
                        && ! [ -f "${arg}/etc/Makefile" ]
                then
@@ -455,7 +462,9 @@
                        BINARYMODE=true
                        BINARYDIRMODE=true
                        BINARYDIR="${arg}"
+                       SRC_ARG="${BINARYDIR}"
                else
+                       echo "*** Cannot understand -s ${arg}"
                        usage
                fi
                ;;
@@ -490,8 +499,7 @@
        usage
 fi
 if ${BINARYDIRMODE}; then
-       SRCDIR="${BINARYDIR}"
-       TEMPROOT="${BINARYDIR}"
+       SRCDIR="${TEMPROOT}"
 fi
 if ${BINARYTGZMODE}; then
        SRCDIR="${TEMPROOT}"
@@ -500,6 +508,7 @@
        # default if no "-s" option was specified
        SOURCEMODE=true
        SRCDIR=/usr/src
+       SRC_ARG="${SRCDIR}"
 fi
 if [ -z "${SRCDIR}" -o -z "${TEMPROOT}" ]; then
        echo "*** ERROR: One of the following variables is undefined"
@@ -509,7 +518,7 @@
        echo ""
        exit 1
 fi
-if ! ${BINARYDIRMODE} && [ -r "${TEMPROOT}" ]; then
+if [ -r "${TEMPROOT}" ]; then
        echo ""
        echo "*** WARNING: ${TEMPROOT} already exists"
        echo ""
@@ -522,16 +531,14 @@
 fi
 
 if ! ${CONTINUE}; then
+       # Create the temporary root directory
+       echo "*** Creating ${TEMPROOT}"
+       mkdir -p "${TEMPROOT}"
+       if [ ! -d "${TEMPROOT}" ]; then
+               echo "*** ERROR: Unable to create ${TEMPROOT}"
+               exit 1
+       fi
        # Are we using the sources or binaries?
-       if ! ${BINARYDIRMODE}; then
-               # Create the temporary root directory
-               echo "*** Creating ${TEMPROOT}"
-               mkdir -p "${TEMPROOT}"
-               if [ ! -d "${TEMPROOT}" ]; then
-                       echo "*** ERROR: Unable to create ${TEMPROOT}"
-                       exit 1
-               fi
-       fi
        if ${BINARYTGZMODE}; then
                # Populate ${TEMPROOT} from ${TGZLIST}
                oldIFS="${IFS}"
@@ -546,14 +553,19 @@
                        [ $? -ne 0 ] && exit 1
                done
                IFS="${oldIFS}"
-       elif ! ${BINARYMODE}; then
-               # Populate ${TEMPROOT} from ${SRCDIR}
+       elif ${BINARYDIRMODE}; then
+               # Populate ${TEMPROOT} from ${SRCDIR} by copying
+               echo "*** Populating ${TEMPROOT} from ${BINARYDIR} (copying)"
+               cp -RPp "${BINARYDIR}"/* "${TEMPROOT}"/
+               [ $? -ne 0 ] && exit 1
+       elif ${SOURCEMODE}; then
+               # Populate ${TEMPROOT} from ${SRCDIR} by running make
                if [ ! -f "${SRCDIR}/etc/Makefile" ]; then
                        echo "*** ERROR: Unable to find ${SRCDIR}/etc/Makefile"
                        exit 1
                fi
                set_makeenv
-               echo "*** Populating ${TEMPROOT} from ${SRCDIR}"
+               echo "*** Populating ${TEMPROOT} from ${SRCDIR} (make distribution)"
                cd ${SRCDIR}/etc
                if ! ${VERBOSE}; then
                        eval ${MAKE_ENV} make distribution > /dev/null
@@ -620,7 +632,7 @@
 fi
 
 # Clean up after "make distribution"
-if ! ${BINARYMODE}; then
+if ${SOURCEMODE}; then
        echo "*** Cleaning up in ${SRCDIR}/etc"
        set_makeenv
        cd ${SRCDIR}/etc
@@ -632,6 +644,21 @@
 fi
 
 # Do some post-installation tasks
+if ${NEED_PWD_MKDB}; then
+       if yesno "Do you want to rebuild the password databases from the" \
+                "new master.passwd"
+       then
+               verbose "Running pwd_mkdb"
+               pwd_mkdb -p "/etc/master.passwd"
+       else
+               echo ""
+               echo "*** You MUST rebuild the password databases to make" \
+                    "the changes visible"
+               echo "*** This is done by running \"pwd_mkdb -p" \
+                    "/etc/master.passwd\" as root"
+               echo ""
+       fi
+fi
 if ${NEED_MTREE}; then
        if yesno "You have created new directories. Run mtree to set" \
                 "permissions"
@@ -663,24 +690,8 @@
                echo ""
        fi
 fi
-if ${NEED_PWD_MKDB}; then
-       if yesno "Do you want to rebuild the password databases from the" \
-                "new master.passwd"
-       then
-               verbose "Running pwd_mkdb"
-               pwd_mkdb -p "/etc/master.passwd"
-       else
-               echo ""
-               echo "*** You MUST rebuild the password databases to make" \
-                    "the changes visible"
-               echo "*** This is done by running \"pwd_mkdb -p" \
-                    "/etc/master.passwd\" as root"
-               echo ""
-       fi
-fi
-if [ -x /etc/postinstall ] && ! ${BINARYMODE}; then
-       # XXX we should also run postinstall in binary mode
+if [ -x /etc/postinstall ]; then
        echo "*** Running /etc/postinstall"
-       /etc/postinstall -s "${SRCDIR}" check
+       /etc/postinstall -s "${SRC_ARG}" check
 fi
 echo "*** All done"
diff -r c5c68579b13e -r a403c0d2e573 usr.sbin/etcupdate/etcupdate.8
--- a/usr.sbin/etcupdate/etcupdate.8    Sun Apr 08 22:27:40 2007 +0000
+++ b/usr.sbin/etcupdate/etcupdate.8    Sun May 27 21:22:23 2007 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: etcupdate.8,v 1.10 2003/04/02 19:30:57 wiz Exp $
+.\"    $NetBSD: etcupdate.8,v 1.10.4.1 2007/05/27 21:22:24 bouyer Exp $
 .\"
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -34,7 +34,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 2, 2003
+.Dd March 25, 2007
 .Dt ETCUPDATE 8
 .Os
 .Sh NAME
@@ -44,9 +44,8 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl ahlv
-.Op Fl b Ar srcdir
 .Op Fl p Ar pager
-.Op Fl s Ar srcdir
+.Op Fl s Brq Ar srcdir | Ar tgzdir | Ar tgzfile
 .Op Fl t Ar temproot
 .Op Fl w Ar width
 .Sh DESCRIPTION
@@ -78,6 +77,11 @@
 from the
 .Xr aliases 5
 file.
+Finally,
+.Nm
+runs
+.Xr postinstall 8
+to check the results.
 .Pp
 .Nm
 needs a clean set of new configuration files to compare the
@@ -102,11 +106,19 @@
 and
 .Fl t Ar temproot
 options later in this manual page.)
+Although this is the default mode, it is not recommended
+(see the
+.Dq BUGS
+section).
 .Pp
-Instead of using sources, the user can also extract one or more binary
-distribution sets in a special location and use those as the reference
-files (see usage of the
-.Fl b Ar srcdir
+Instead of using sources, it is recommended that the user should extract
+one or more binary distribution sets in a special location and use those
+as the reference files (see usage of the
+.Fl s Ar tgzdir
+option later in this manual page),
+or specify one or more binary distribution sets directly
+(see usage of the
+.Fl s Ar tgzfile
 option later in this manual page).
 .Pp
 The following options are available:
@@ -122,19 +134,6 @@
 .Pa /var/etcupdate
 and use these checksums to determine if there have been any
 local modifications.
-.It Fl b Ar srcdir
-Location of reference files extracted from a binary distribution of
-.Nx .
-Note that reference files in
-.Pa srcdir
-will be altered and removed by
-.Nm
-when using the
-.Fl b Ar srcdir
-option (as the
-.Pa srcdir
-directory is treated like
-.Pa temproot ) .
 .It Fl h
 Prints a help text.



Home | Main Index | Thread Index | Old Index