Module Name: src
Committed By: apb
Date: Thu Jun 12 13:40:43 UTC 2014
Modified Files:
src/usr.sbin/etcupdate: etcupdate
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/etcupdate/etcupdate
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/etcupdate/etcupdate
diff -u src/usr.sbin/etcupdate/etcupdate:1.53 src/usr.sbin/etcupdate/etcupdate:1.54
--- src/usr.sbin/etcupdate/etcupdate:1.53 Thu Jun 12 13:33:43 2014
+++ src/usr.sbin/etcupdate/etcupdate Thu Jun 12 13:40:43 2014
@@ -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 @@ if [ "${N_SRC_ARGS}" -gt 1 ] && ( ${SOUR
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 @@ if ! ${CONTINUE}; then
[ $? -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