CVS commit: src/usr.sbin/etcupdate

2010-06-24 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jun 24 17:12:06 UTC 2010

Modified Files:
src/usr.sbin/etcupdate: etcupdate

Log Message:
Run services_mkdb if only the old hash exists


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 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.49 src/usr.sbin/etcupdate/etcupdate:1.50
--- src/usr.sbin/etcupdate/etcupdate:1.49	Sat Nov  8 02:11:54 2008
+++ src/usr.sbin/etcupdate/etcupdate	Thu Jun 24 17:12:06 2010
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.49 2008/11/08 02:11:54 reed Exp $
+# $NetBSD: etcupdate,v 1.50 2010/06/24 17:12:06 joerg Exp $
 #
 # Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -664,6 +664,13 @@
 		echo ""
 	fi
 fi
+
+if ! ${NEED_SERVICES_MKDB}; then
+	if test -e /var/db/services.db -a ! -e /var/db/services.cdb; then
+		NEED_SERVICES_MKDB=true
+	fi
+fi
+
 if ${NEED_SERVICES_MKDB}; then
 	if yesno "Do you want to rebuild the services databases from the" \
 	 "new /etc/services"



CVS commit: src/usr.sbin/etcupdate

2009-12-08 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Tue Dec  8 09:46:35 UTC 2009

Modified Files:
src/usr.sbin/etcupdate: etcupdate.8

Log Message:
s/the the/the/


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/etcupdate/etcupdate.8

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.8
diff -u src/usr.sbin/etcupdate/etcupdate.8:1.18 src/usr.sbin/etcupdate/etcupdate.8:1.19
--- src/usr.sbin/etcupdate/etcupdate.8:1.18	Sat Oct  4 08:07:38 2008
+++ src/usr.sbin/etcupdate/etcupdate.8	Tue Dec  8 09:46:35 2009
@@ -1,4 +1,4 @@
-.\"	$NetBSD: etcupdate.8,v 1.18 2008/10/04 08:07:38 apb Exp $
+.\"	$NetBSD: etcupdate.8,v 1.19 2009/12/08 09:46:35 mbalmer Exp $
 .\"
 .\" Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -376,7 +376,7 @@
 .Pp
 In
 .Nx 5.0 ,
-the the ability to specify multiple colon-separated files with a single
+the ability to specify multiple colon-separated files with a single
 .Fl s
 option was deprecated,
 and options deprecated in



CVS commit: src/usr.sbin/etcupdate

2012-08-15 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Wed Aug 15 16:26:41 UTC 2012

Modified Files:
src/usr.sbin/etcupdate: etcupdate etcupdate.8

Log Message:
Remove the ability to specify multiple colon-separated file names with
a single "-s" option.  Multiple "-s" options must now be used instead.
We have been printing a warning about this since 2008-09-14.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/etcupdate/etcupdate
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/etcupdate/etcupdate.8

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.50 src/usr.sbin/etcupdate/etcupdate:1.51
--- src/usr.sbin/etcupdate/etcupdate:1.50	Thu Jun 24 17:12:06 2010
+++ src/usr.sbin/etcupdate/etcupdate	Wed Aug 15 16:26:41 2012
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.50 2010/06/24 17:12:06 joerg Exp $
+# $NetBSD: etcupdate,v 1.51 2012/08/15 16:26:41 apb Exp $
 #
 # Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -455,19 +455,6 @@ do
 			BINARYMODE=true
 			BINARYDIRMODE=true
 			BINARYDIR="${arg}"
-		elif [ -f "${arg%%:*}" -a -f "${arg##*:}" -a ! -f "${arg}" ]
-		then
-			# Backward compatibility: allow arg to refer
-			# to a colon-separated list of tgz files.
-			# Remove this after NetBSD-5.0 is released.
-			cat <

CVS commit: src/usr.sbin/etcupdate

2016-01-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan  3 08:44:59 UTC 2016

Modified Files:
src/usr.sbin/etcupdate: etcupdate

Log Message:
>From Jim Bernard in PR install/50615: install_checksum expects a path
relative to ${DESTDIR}, and most callers did pass it that way - fix the
one place where it eroneously was called with a ${DESTDIR} path.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 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.59 src/usr.sbin/etcupdate/etcupdate:1.60
--- src/usr.sbin/etcupdate/etcupdate:1.59	Thu Nov 13 07:11:06 2014
+++ src/usr.sbin/etcupdate/etcupdate	Sun Jan  3 08:44:59 2016
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.59 2014/11/13 07:11:06 apb Exp $
+# $NetBSD: etcupdate,v 1.60 2016/01/03 08:44:59 martin Exp $
 #
 # Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -280,7 +280,7 @@ diff_and_merge_file() {
 	if cmp -s "${TEMPROOT}${1}" "${DESTDIR}${1}"; then
 		verbose "===> ${1} (ok)"
 		rm -f "${TEMPROOT}${1}"
-		install_checksum "${DESTDIR}${1}"
+		install_checksum "${1}"
 		return
 	fi
 



CVS commit: src/usr.sbin/etcupdate

2014-11-12 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Nov 13 07:11:06 UTC 2014

Modified Files:
src/usr.sbin/etcupdate: etcupdate

Log Message:
Synchronise the "-s" part of the usage message with postinstall.
A colon-separated list of tgz files is no longer accepted; you
must use multiple -s options instead.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 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.58 src/usr.sbin/etcupdate/etcupdate:1.59
--- src/usr.sbin/etcupdate/etcupdate:1.58	Mon Aug  4 21:56:30 2014
+++ src/usr.sbin/etcupdate/etcupdate	Thu Nov 13 07:11:06 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.58 2014/08/04 21:56:30 apb Exp $
+# $NetBSD: etcupdate,v 1.59 2014/11/13 07:11:06 apb Exp $
 #
 # Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -93,9 +93,10 @@ Options:
following:
* A directory that contains a NetBSD source tree;
* 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.
+ "xetc.tgz".  Pass multiple -s options to specify
+ multiple 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)
   -d destdir   Destination directory to check. (default: /)
   -w width Screen width(default: 80)



CVS commit: src/usr.sbin/etcupdate

2014-06-12 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Jun 12 13:33:43 UTC 2014

Modified Files:
src/usr.sbin/etcupdate: etcupdate

Log Message:
There is a file named "._etcupdate_${TEMPROOT}${1}" was
never created, so don't try to delete it.  Delete "$B" instead.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 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.52 src/usr.sbin/etcupdate/etcupdate:1.53
--- src/usr.sbin/etcupdate/etcupdate:1.52	Thu Jun 12 13:31:47 2014
+++ src/usr.sbin/etcupdate/etcupdate	Thu Jun 12 13:33:43 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.52 2014/06/12 13:31:47 apb Exp $
+# $NetBSD: etcupdate,v 1.53 2014/06/12 13:33:43 apb Exp $
 #
 # Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -378,7 +378,7 @@ EOF
 			;;
 		esac
 	done
-	rm -f "._etcupdate_${TEMPROOT}${1}"
+	rm -f "$B"
 }
 
 # Set the environment for make.



CVS commit: src/usr.sbin/etcupdate

2014-06-12 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Jun 12 13:31:48 UTC 2014

Modified Files:
src/usr.sbin/etcupdate: etcupdate

Log Message:
When processing the -s option, the variable used is ${arg},
not ${ARG}.  Also adjust an error message to say
"Nonexistent or invalid file or directory", not just
"Nonexistent file or directory".


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 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.51 src/usr.sbin/etcupdate/etcupdate:1.52
--- src/usr.sbin/etcupdate/etcupdate:1.51	Wed Aug 15 16:26:41 2012
+++ src/usr.sbin/etcupdate/etcupdate	Thu Jun 12 13:31:47 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.51 2012/08/15 16:26:41 apb Exp $
+# $NetBSD: etcupdate,v 1.52 2014/06/12 13:31:47 apb Exp $
 #
 # Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -447,7 +447,7 @@ do
 			# arg refers to a source directory
 			SOURCEMODE=true
 			SRCDIR="${arg}"
-		elif [ -d "${arg}" ] && [ -d "${ARG}/etc" ] \
+		elif [ -d "${arg}" ] && [ -d "${arg}/etc" ] \
 			&& ! [ -f "${arg}/etc/Makefile" ]
 		then
 			# arg refers to a directory where the
@@ -456,7 +456,8 @@ do
 			BINARYDIRMODE=true
 			BINARYDIR="${arg}"
 		else
-			echo "*** Nonexistent file or directory for -s ${arg}"
+			echo "*** Nonexistent or invalid file or directory" \
+			 "for -s ${arg}"
 			usage
 		fi
 		;;



CVS commit: src/usr.sbin/etcupdate

2014-06-12 Thread Alan Barrett
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



CVS commit: src/usr.sbin/etcupdate

2014-06-12 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Jun 12 13:42:05 UTC 2014

Modified Files:
src/usr.sbin/etcupdate: etcupdate

Log Message:
Keep track of whether anything was changed (or needs to be changed),
and print a message at the end if nothing needs to be done.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 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.54 src/usr.sbin/etcupdate/etcupdate:1.55
--- src/usr.sbin/etcupdate/etcupdate:1.54	Thu Jun 12 13:40:43 2014
+++ src/usr.sbin/etcupdate/etcupdate	Thu Jun 12 13:42:05 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.54 2014/06/12 13:40:43 apb Exp $
+# $NetBSD: etcupdate,v 1.55 2014/06/12 13:42:05 apb Exp $
 #
 # Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -70,6 +70,7 @@ MACHINE_ARCH="${MACHINE_ARCH:="$(uname -
 export MACHINE_ARCH
 
 # Settings for post-installation procedures
+NEED_ANYTHING=false
 NEED_MAKEDEV=false
 NEED_MTREE=false
 NEED_NEWALIASES=false
@@ -153,6 +154,7 @@ shell_quote()
 install_dir() {
 	# $1 = target directory
 
+	NEED_ANYTHING=true
 	if yesno "Create ${1}"; then
 		verbose "Creating ${1}"
 		mkdir -p "${1}" || exit 1
@@ -163,6 +165,7 @@ install_dir() {
 install_file() {
 	# $1 = target file
 
+	NEED_ANYTHING=true
 	# Install the new file
 	verbose "Installing ${1}"
 	cp -p "${TEMPROOT}${1}" "${1}" && rm -f "${TEMPROOT}${1}"
@@ -192,6 +195,7 @@ install_checksum() {
 
 	${AUTOMATIC} || return
 
+	NEED_ANYTHING=true
 	D="$(dirname "${1}")"
 	mkdir -p "/var/etcupdate/${D}"
 	verbose "Saving MD5 checksum for ${1} to /var/etcupdate/${1}"
@@ -637,6 +641,10 @@ if [ ! -z "${REMAINING}" ]; then
 	echo ""
 	echo "${REMAINING}" | sed -e 's/^/  /'
 	echo ""
+elif ! ${NEED_ANYTHING}; then
+	echo ""
+	echo "*** No changes were needed"
+	echo ""
 fi
 if yesno "Remove ${TEMPROOT}"; then
 	echo "*** Removing ${TEMPROOT}"



CVS commit: src/usr.sbin/etcupdate

2014-06-12 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Jun 12 13:56:32 UTC 2014

Modified Files:
src/usr.sbin/etcupdate: etcupdate etcupdate.8

Log Message:
Add "-d destdir" option to etcupdate.
This has been only lightly tested.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/etcupdate/etcupdate
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/etcupdate/etcupdate.8

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.55 src/usr.sbin/etcupdate/etcupdate:1.56
--- src/usr.sbin/etcupdate/etcupdate:1.55	Thu Jun 12 13:42:05 2014
+++ src/usr.sbin/etcupdate/etcupdate	Thu Jun 12 13:56:32 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.55 2014/06/12 13:42:05 apb Exp $
+# $NetBSD: etcupdate,v 1.56 2014/06/12 13:56:32 apb Exp $
 #
 # Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -46,6 +46,8 @@ PATH="/sbin:/usr/sbin:/bin:/usr/bin:${PA
 
 # Default settings
 PROG="${0##*/}"
+DESTDIR=""		# must not have a trailing slash
+DESTDIR_BRE=""		# basic regex to match ${DESTDIR}
 TEMPROOT="${TEMPROOT:=/tmp/temproot}"
 PAGER="${PAGER:=/usr/bin/more}"
 SWIDTH="$(stty size | awk '{w=$2}END{if(w==0){w=80}print w}')"
@@ -60,7 +62,7 @@ BINARYDIRMODE=false	# true for "-s extra
 BINARYDIR=		# directory name for BINARYDIRMODE
 BINARYTGZMODE=false	# true for "-s etc.tgz"
 TGZLIST=		# quoted list list of files for BINARYTGZMODE
-SRC_ARGLIST=		# quoted list of one or more "-s" args
+SRC_ARGLIST=		# quoted list of "-s" args
 N_SRC_ARGS=0		# number of "-s" args
 AUTOMATIC=false
 LOCALSKIP=false
@@ -95,6 +97,7 @@ Options:
* 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)
+  -d destdir   Destination directory to check. (default: /)
   -w width Screen width(default: 80)
   -a   Automatically update unmodified files
   -l   Automatically skip files with strictly local changes
@@ -151,24 +154,38 @@ shell_quote()
 	printf "%s\n" "$result"
 }
 
+# Convert arg $1 to a basic regular expression (as in sed)
+# that will match the arg.  This works by inserting backslashes
+# before characters that are special in basic regular expressions.
+# It also inserts backslashes before the extra characters specified
+# in $2 (which defaults to "/,").
+# XXX: Does not handle embedded newlines.
+# Usage: regex="$(bre_quote "${string}")"
+bre_quote()
+{
+	local arg="$1"
+	local extra="$2:/,"
+	printf "%s\n" "${arg}" | sed -e 's/[][^$.*\\'"${extra}"']/\\&/g'
+}
+
 install_dir() {
-	# $1 = target directory
+	# $1 = target directory (relative to ${DESTDIR})
 
 	NEED_ANYTHING=true
-	if yesno "Create ${1}"; then
-		verbose "Creating ${1}"
-		mkdir -p "${1}" || exit 1
+	if yesno "Create ${DESTDIR}${1}"; then
+		verbose "Creating ${DESTDIR}${1}"
+		mkdir -p "${DESTDIR}${1}" || exit 1
 		NEED_MTREE=true
 	fi
 }
 
 install_file() {
-	# $1 = target file
+	# $1 = target file (relative to ${DESTDIR})
 
 	NEED_ANYTHING=true
 	# Install the new file
-	verbose "Installing ${1}"
-	cp -p "${TEMPROOT}${1}" "${1}" && rm -f "${TEMPROOT}${1}"
+	verbose "Installing ${DESTDIR}${1}"
+	cp -p "${TEMPROOT}${1}" "${DESTDIR}${1}" && rm -f "${TEMPROOT}${1}"
 
 	# Check if this was a special file
 	case "${1}" in
@@ -191,15 +208,20 @@ install_file() {
 }
 
 install_checksum() {
-	# $1 = target file
+	# $1 = target file (relative to ${DESTDIR})
 
 	${AUTOMATIC} || return
 
 	NEED_ANYTHING=true
 	D="$(dirname "${1}")"
-	mkdir -p "/var/etcupdate/${D}"
-	verbose "Saving MD5 checksum for ${1} to /var/etcupdate/${1}"
-	md5 "${1}" > "/var/etcupdate/${1}"
+	mkdir -p "${DESTDIR}/var/etcupdate/${D}"
+	verbose "Saving MD5 checksum for ${DESTDIR}${1} to" \
+	"${DESTDIR}/var/etcupdate/${1}"
+	# The sed part of the following pipeline changes things like
+	# "MD5 (/path/to/dest/dir/etc/filename) = abc123" to
+	# "MD5 (/etc/filename) = abc123".
+	md5 "${DESTDIR}${1}" | sed -e "s,(${DESTDIR_BRE},(," \
+	> "${DESTDIR}/var/etcupdate/${1}"
 }
 
 # Initialise the DIFF_EXTRA_OPTIONS variable.
@@ -230,18 +252,18 @@ init_diff_extra_options() {
 }
 
 diff_and_merge_file() {
-	# $1 = target file
+	# $1 = target file (relative to ${DESTDIR})
 
-	if cmp -s "${TEMPROOT}${1}" "${1}"; then
+	if cmp -s "${TEMPROOT}${1}" "${DESTDIR}${1}"; then
 		verbose "===> ${1} (ok)"
 		rm -f "${TEMPROOT}${1}"
-		install_checksum "${1}"
+		install_checksum "${DESTDIR}${1}"
 		return
 	fi
 
-	if ${AUTOMATIC} && [ -f "/var/etcupdate/${1}" ]; then
+	if ${AUTOMATIC} && [ -f "${DESTDIR}/var/etcupdate/${1}" ]; then
 		SUM1="$(md5 "${1}")"
-		SUM2="$(cat "/var/etcupdate/${1}")"
+		SUM2="$(cat "${DESTDIR}/var/etcupdate/${1}")"
 		if [ "${SUM1}" = "${SUM2}" ]; then
 			install_file "${1}"
 			install_checksum "${1}"
@@ -2

CVS commit: src/usr.sbin/etcupdate

2014-06-12 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Jun 12 14:07:13 UTC 2014

Modified Files:
src/usr.sbin/etcupdate: etcupdate.8

Log Message:
Update date for previous, and fix some small errors.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/etcupdate/etcupdate.8

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.8
diff -u src/usr.sbin/etcupdate/etcupdate.8:1.21 src/usr.sbin/etcupdate/etcupdate.8:1.22
--- src/usr.sbin/etcupdate/etcupdate.8:1.21	Thu Jun 12 13:56:32 2014
+++ src/usr.sbin/etcupdate/etcupdate.8	Thu Jun 12 14:07:13 2014
@@ -1,4 +1,4 @@
-.\"	$NetBSD: etcupdate.8,v 1.21 2014/06/12 13:56:32 apb Exp $
+.\"	$NetBSD: etcupdate.8,v 1.22 2014/06/12 14:07:13 apb Exp $
 .\"
 .\" Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 15, 2012
+.Dd June 12, 2014
 .Dt ETCUPDATE 8
 .Os
 .Sh NAME
@@ -147,7 +147,6 @@ For example,
 .Ar destdir Ns Pa /etc
 will be used instead of
 .Pa /etc .
-.Pa \&/ .
 .It Fl h
 Prints a help text.
 .It Fl l
@@ -401,7 +400,7 @@ the ability to specify multiple colon-se
 .Fl s
 option was removed (multiple
 .Fl s
-options must be used instead,
+options must be used instead),
 and the
 .Fl d Ar destdir
 option was added.



CVS commit: src/usr.sbin/etcupdate

2018-11-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 21 20:18:12 UTC 2018

Modified Files:
src/usr.sbin/etcupdate: etcupdate.8

Log Message:
A few hints that sets may come in .tar.xz format (instead of .tgz)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/etcupdate/etcupdate.8

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.8
diff -u src/usr.sbin/etcupdate/etcupdate.8:1.22 src/usr.sbin/etcupdate/etcupdate.8:1.23
--- src/usr.sbin/etcupdate/etcupdate.8:1.22	Thu Jun 12 14:07:13 2014
+++ src/usr.sbin/etcupdate/etcupdate.8	Wed Nov 21 20:18:11 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: etcupdate.8,v 1.22 2014/06/12 14:07:13 apb Exp $
+.\"	$NetBSD: etcupdate.8,v 1.23 2018/11/21 20:18:11 martin Exp $
 .\"
 .\" Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 12, 2014
+.Dd November 20, 2018
 .Dt ETCUPDATE 8
 .Os
 .Sh NAME
@@ -204,9 +204,13 @@ extracted from a binary distribution of
 .Nx .
 The files that are distributed in the
 .Dq Pa etc.tgz
+or
+.Dq Pa etc.tar.xz
 set file must be present.
 The files that are distributed in the
 .Dq Pa xetc.tgz
+or
+.Dq Pa xetc.tar.xz
 set file are optional.
 The reference files from the specified directory will be copied to the
 .Pa temproot
@@ -216,7 +220,8 @@ The location of a set file
 (or
 .Dq "tgz file" )
 such as
-.Dq Pa etc.tgz
+.Dq Pa etc.tgz ,
+.Dq Pa etc.tar.xz
 or
 .Dq Pa xetc.tgz
 from a binary distribution of
@@ -230,9 +235,13 @@ Multiple
 options may be used to specify multiple set files.
 The
 .Dq Pa etc.tgz
+or
+.Dq Pa etc.tar.xz
 set file must be specified.
 The
 .Dq Pa xetc.tgz
+or
+.Dq Pa xetc.tar.xz
 set file is optional.
 .El
 .It Fl t Ar temproot