Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/etcupdate When populating ${TEMPROOT} from ${SRCDIR...



details:   https://anonhg.NetBSD.org/src/rev/62052636dab1
branches:  trunk
changeset: 329854:62052636dab1
user:      apb <apb%NetBSD.org@localhost>
date:      Thu Jun 12 13:40:43 2014 +0000

description:
When populating ${TEMPROOT} from ${SRCDIR} by copying, use the mtree set
files from ${BINARYDIR}/etc/mtree/set.{etc,xetc} as a list of files to
copy (and copy using pax instead of cp).

This prevents unnecessary copying of extraneous files, such as in the
case that BINARYDIR refers to a directory where everything has been
unpacked, instead of a directory where only the etc and xetc sets have
been unpacked.

Also convert a relative TEMOROOT to an absolute path.

diffstat:

 usr.sbin/etcupdate/etcupdate |  29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r c260165d54c9 -r 62052636dab1 usr.sbin/etcupdate/etcupdate
--- a/usr.sbin/etcupdate/etcupdate      Thu Jun 12 13:33:43 2014 +0000
+++ b/usr.sbin/etcupdate/etcupdate      Thu Jun 12 13:40:43 2014 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.53 2014/06/12 13:33:43 apb Exp $
+# $NetBSD: etcupdate,v 1.54 2014/06/12 13:40:43 apb Exp $
 #
 # Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -487,6 +487,13 @@
        echo "*** ERROR: Multiple -s args are allowed only with tgz files"
        usage
 fi
+case "${TEMPROOT}" in
+/*) : OK ;;
+*)  new="${PWD:-$(pwd)}/${TEMPROOT}"
+    echo "*** NOTE: Using TEMPROOT \"${new}\" instead of \"${TEMPROOT}\""
+    TEMPROOT="${new}"
+    ;;
+esac
 if ${BINARYDIRMODE}; then
        SRCDIR="${TEMPROOT}"
 fi
@@ -541,10 +548,24 @@
                        [ $? -ne 0 ] && exit 1
                done
        elif ${BINARYDIRMODE}; then
-               # Populate ${TEMPROOT} from ${SRCDIR} by copying
+               # Populate ${TEMPROOT} from ${SRCDIR} by copying.
+               # Copy only the files that belong to the etc and xetc sets.
                echo "*** Populating ${TEMPROOT} from ${BINARYDIR} (copying)"
-               cp -RPp "${BINARYDIR}"/* "${TEMPROOT}"/
-               [ $? -ne 0 ] && exit 1
+               for setname in etc xetc; do
+                       mtreefile="${BINARYDIR}/etc/mtree/set.${setname}"
+                       if ${VERBOSE}; then vflag="-v"; else vflag=""; fi
+                       if [ -f "${mtreefile}" ]; then
+                               echo "*** Copying files belonging to" \
+                                    "${setname} set"
+                               (cd "${BINARYDIR}" \
+                                && pax -rwdM ${vflag} "${TEMPROOT%/}/."
+                               ) <"${mtreefile}"
+                               [ $? -ne 0 ] && exit 1
+                       else
+                               echo "*** Not copying files belonging to" \
+                                    "${setname} set: ${mtreefile} not found"
+                       fi
+               done
        elif ${SOURCEMODE}; then
                # Populate ${TEMPROOT} from ${SRCDIR} by running make
                if [ ! -f "${SRCDIR}/etc/Makefile" ]; then



Home | Main Index | Thread Index | Old Index