CVS commit: src/usr.sbin/postinstall

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 16:44:54 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
remove dup named dir


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.62 src/usr.sbin/postinstall/postinstall.in:1.63
--- src/usr.sbin/postinstall/postinstall.in:1.62	Sun Mar 10 14:23:18 2024
+++ src/usr.sbin/postinstall/postinstall.in	Fri Apr  5 12:44:54 2024
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.62 2024/03/10 18:23:18 rillig Exp $
+# $NetBSD: postinstall.in,v 1.63 2024/04/05 16:44:54 christos Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1706,6 +1706,12 @@ do_named()
 	compare_dir "${op}" "${SRC_DIR}/etc/namedb" "${DEST_DIR}/etc/namedb" \
 		644 \
 		root.cache
+
+	local od="${DEST_DIR}/usr/libexec/named"
+	if [ -d "$od" ]; then
+		rm -fr "$od"
+		msg "Removed obsolete '${od}'"
+	fi
 }
 
 



CVS commit: src/usr.sbin/postinstall

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 16:44:54 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
remove dup named dir


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2024-03-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 10 18:23:18 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: fix parameter order in usage message


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.61 src/usr.sbin/postinstall/postinstall.in:1.62
--- src/usr.sbin/postinstall/postinstall.in:1.61	Sat Mar  9 06:51:40 2024
+++ src/usr.sbin/postinstall/postinstall.in	Sun Mar 10 18:23:18 2024
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.61 2024/03/09 06:51:40 rillig Exp $
+# $NetBSD: postinstall.in,v 1.62 2024/03/10 18:23:18 rillig Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -235,7 +235,7 @@ check_dir()
 #
 check_ids()
 {
-	[ $# -ge 6 ] || err 3 "USAGE: checks_ids op type file start srcfile id ..."
+	[ $# -ge 6 ] || err 3 "USAGE: checks_ids op type file srcfile start id ..."
 	local op="$1"
 	local type="$2"
 	local file="$3"



CVS commit: src/usr.sbin/postinstall

2024-03-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 10 18:23:18 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: fix parameter order in usage message


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2024-03-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Mar  9 06:51:40 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: fix endless loop (since 2024-03-07)


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2024-03-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Mar  9 06:51:40 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: fix endless loop (since 2024-03-07)


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.60 src/usr.sbin/postinstall/postinstall.in:1.61
--- src/usr.sbin/postinstall/postinstall.in:1.60	Thu Mar  7 22:03:16 2024
+++ src/usr.sbin/postinstall/postinstall.in	Sat Mar  9 06:51:40 2024
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.60 2024/03/07 22:03:16 christos Exp $
+# $NetBSD: postinstall.in,v 1.61 2024/03/09 06:51:40 rillig Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -100,7 +100,7 @@ mkdtemp()
 	while true; do
 		dir="${base}.${serial}"
 		mkdir -m 0700 "${dir}" && break
-		_serial=$((${serial} + 1))
+		serial=$((${serial} + 1))
 	done
 	echo "${dir}"
 }



CVS commit: src/usr.sbin/postinstall

2024-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar  7 22:03:16 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
no local in loops, simplify eval (thanks kre)


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.59 src/usr.sbin/postinstall/postinstall.in:1.60
--- src/usr.sbin/postinstall/postinstall.in:1.59	Thu Mar  7 11:54:16 2024
+++ src/usr.sbin/postinstall/postinstall.in	Thu Mar  7 17:03:16 2024
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.59 2024/03/07 16:54:16 christos Exp $
+# $NetBSD: postinstall.in,v 1.60 2024/03/07 22:03:16 christos Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -95,9 +95,10 @@ mkdtemp()
 
 	local base="/tmp/_postinstall.$$"
 	local serial=0
+	local dir
 
 	while true; do
-		local dir="${base}.${serial}"
+		dir="${base}.${serial}"
 		mkdir -m 0700 "${dir}" && break
 		_serial=$((${serial} + 1))
 	done
@@ -320,11 +321,11 @@ populate_dir()
 	check_dir "${op}" "${dst}" 755 || return 1
 
 	local cmpdir_rv=0
-	local f
+	local f fs fd error
 	for f in "$@"; do
-		local fs="${src}/${f}"
-		local fd="${dst}/${f}"
-		local error=""
+		fs="${src}/${f}"
+		fd="${dst}/${f}"
+		error=""
 		if [ ! -f "${fd}" ]; then
 			error="${fd} does not exist"
 		elif ! cmp -s "${fs}" "${fd}" ; then
@@ -423,8 +424,7 @@ rcconf_is_set()
 			[ -f "${f}" ] && . "${f}"
 		done
 		eval echo -n \"\${${var}}\" 1>&3
-		if eval "[ -n \"\${${var}}\" \
-			-o \"\${${var}-UNSET}\" != \"UNSET\" ]"; then
+		if eval "[ -n \"\${${var}+SET}\" ]"; then
 			if [ -n "${verbose}" ]; then
 msg \
 "Obsolete rc.conf(5) variable '\$${var}' found.${notfixed}"
@@ -963,11 +963,11 @@ do_blocklist()
 {
 	[ -n "$1" ] || err 3 "USAGE: do_blocklist fix|check"
 	local op="$1"
-	local i
+	local i old
 
 	# if we are actually using blocklistd
 	for i in /var/db/blacklist.db /etc/blacklistd.conf; do
-		local old="${DEST_DIR}${i}"
+		old="${DEST_DIR}${i}"
 		if [ ! -f "${old}" ]; then
 			continue
 		elif [ "$1" = "check" ]; then
@@ -1068,6 +1068,7 @@ do_catpages()
 {
 	local op="$1"
 	local failed=0
+	local manbase sec
 	for manbase in /usr/share/man /usr/X11R6/man /usr/X11R7/man; do
 		for sec in 1 2 3 4 5 6 7 8 9; do
 			obsolete_catpages "$1" "${DEST_DIR}${manbase}" "${sec}"
@@ -2200,8 +2201,8 @@ do_rc()
 		${extra_scripts}
 	failed=$(( ${failed} + $? ))
 
+	local i rc_file
 	for i in ${rc_external_files}; do
-	local rc_file
 	case $i in
 	*d) rc_file=${i};;
 	*)	rc_file=${i}d;;
@@ -2527,6 +2528,7 @@ do_x11()
 		notfixed="${NOT_FIXED}"
 	fi
 
+	local d
 	# check if /usr/X11R6/lib/X11 needs to migrate to /etc/X11
 	if [ -n "${libx11}" ]; then
 		for d in \



CVS commit: src/usr.sbin/postinstall

2024-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar  7 22:03:16 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
no local in loops, simplify eval (thanks kre)


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2024-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar  7 16:54:16 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
- fix named.conf (remove dnssec-enable option)
- use proper local variables instead of adding _ or other prefixes.
- centralize rm use
- use grep -q instead of > /dev/null
- reduce constant duplication


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2024-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar  7 16:54:16 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
- fix named.conf (remove dnssec-enable option)
- use proper local variables instead of adding _ or other prefixes.
- centralize rm use
- use grep -q instead of > /dev/null
- reduce constant duplication


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.58 src/usr.sbin/postinstall/postinstall.in:1.59
--- src/usr.sbin/postinstall/postinstall.in:1.58	Sun Jan 28 19:57:38 2024
+++ src/usr.sbin/postinstall/postinstall.in	Thu Mar  7 11:54:16 2024
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.58 2024/01/29 00:57:38 riastradh Exp $
+# $NetBSD: postinstall.in,v 1.59 2024/03/07 16:54:16 christos Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -60,6 +60,7 @@
 : ${SED:=sed}
 : ${SORT:=sort}
 : ${STAT:=stat}
+: ${RM:=rm}
 
 #
 #	helper functions
@@ -67,11 +68,11 @@
 
 err()
 {
-	exitval=$1
+	local exitval=$1
 	shift
 	echo 1>&2 "${PROGNAME}: $*"
 	if [ -n "${SCRATCHDIR}" ]; then
-	/bin/rm -rf "${SCRATCHDIR}"
+	${RM} -rf "${SCRATCHDIR}"
 	fi
 	exit ${exitval}
 }
@@ -92,15 +93,15 @@ mkdtemp()
 	[ -d /tmp ] || err 2 /tmp is not a directory
 	[ -w /tmp ] || err 2 /tmp is not writable
 
-	_base="/tmp/_postinstall.$$"
-	_serial=0
+	local base="/tmp/_postinstall.$$"
+	local serial=0
 
 	while true; do
-		_dir="${_base}.${_serial}"
-		mkdir -m 0700 "${_dir}" && break
-		_serial=$((${_serial} + 1))
+		local dir="${base}.${serial}"
+		mkdir -m 0700 "${dir}" && break
+		_serial=$((${serial} + 1))
 	done
-	echo "${_dir}"
+	echo "${dir}"
 }
 
 # Quote args to make them safe in the shell.
@@ -131,7 +132,7 @@ shell_quote()
 			# '\'''\'' sequences that result from multiple
 			# adjacent quotes in he input.
 			qarg="$(printf "%s\n" "$arg" | \
-			${SED:-sed} -e "s/'/'''/g" \
+			${SED} -e "s/'/'''/g" \
 -e "1s/^/'/" -e "\$s/\$/'/" \
 -e "1s/^''//" -e "\$s/''\$//" \
 -e "s/'''/'/g"
@@ -206,18 +207,18 @@ adddisableditem()
 check_dir()
 {
 	[ $# -eq 3 ] || err 3 "USAGE: check_dir op dir mode"
-	_cdop="$1"
-	_cddir="$2"
-	_cdmode="$3"
-	[ -d "${_cddir}" ] && return 0
-	if [ "${_cdop}" = "check" ]; then
-		msg "${_cddir} is not a directory"
+	local op="$1"
+	local dir="$2"
+	local mode="$3"
+	[ -d "${dir}" ] && return 0
+	if [ "${op}" = "check" ]; then
+		msg "${dir} is not a directory"
 		return 1
-	elif ! mkdir -m "${_cdmode}" "${_cddir}" ; then
-		msg "Can't create missing ${_cddir}"
+	elif ! mkdir -m "${mode}" "${dir}" ; then
+		msg "Can't create missing ${dir}"
 		return 1
 	else
-		msg "Missing ${_cddir} created"
+		msg "Missing ${dir} created"
 	fi
 	return 0
 }
@@ -234,27 +235,27 @@ check_dir()
 check_ids()
 {
 	[ $# -ge 6 ] || err 3 "USAGE: checks_ids op type file start srcfile id ..."
-	_op="$1"
-	_type="$2"
-	_file="$3"
-	_srcfile="$4"
-	_start="$5"
+	local op="$1"
+	local type="$2"
+	local file="$3"
+	local srcfile="$4"
+	local start="$5"
 	shift 5
-	#_ids="$@"
+	#local ids="$@"
 
-	if [ ! -f "${_file}" ]; then
-		msg "${_file} doesn't exist; can't check for missing ${_type}"
+	if [ ! -f "${file}" ]; then
+		msg "${file} doesn't exist; can't check for missing ${type}"
 		return 1
 	fi
-	if [ ! -r "${_file}" ]; then
-		msg "${_file} is not readable; can't check for missing ${_type}"
+	if [ ! -r "${file}" ]; then
+		msg "${file} is not readable; can't check for missing ${type}"
 		return 1
 	fi
-	_notfixed=""
-	if [ "${_op}" = "fix" ]; then
-		_notfixed="${NOT_FIXED}"
+	local notfixed=""
+	if [ "${op}" = "fix" ]; then
+		notfixed="${NOT_FIXED}"
 	fi
-	_missing="$(${AWK} -v start=$_start -F: '
+	local missing="$(${AWK} -v start=$start -F: '
 		BEGIN {
 			for (x = 1; x < ARGC; x++) {
 if (ARGV[x] == "SKIP")
@@ -278,14 +279,14 @@ check_ids()
 start++;
 			}
 		}
-	' "$@" < "${_file}")"	|| return 1
-	if [ -n "${_missing}" ]; then
-		msg "Error ${_type}${_notfixed}:" $(echo ${_missing})
+	' "$@" < "${file}")"	|| return 1
+	if [ -n "${missing}" ]; then
+		msg "Error ${type}${notfixed}:" $(echo ${missing})
 		msg "Use the following as a template:"
-		set -- ${_missing}
+		set -- ${missing}
 		while [ $# -gt 0 ]
 		do
-			${GREP} -E "^${1}:" ${_srcfile}
+			${GREP} -E "^${1}:" ${srcfile}
 			shift 2
 		done | sort -t: -k3n
 		msg "and adjust if necessary."
@@ -294,8 +295,8 @@ check_ids()
 	return 0
 }
 
-# populate_dir op onlynew src dest mode file ...
-#	Perform op ("check" or "fix") on files in src/ against dest/
+# populate_dir op onlynew src dst mode file ...
+#	Perform op ("check" or "fix") on files in src/ against dst/
 #	If op = "check" display missing or changed files, optionally with 

CVS commit: src/usr.sbin/postinstall

2024-01-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jan 29 00:57:38 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall(8): Don't say /etc/openssl/certs.conf already exists.

It's confusing when all the other `postinstall fix' actions are
silent in the event they don't have anything to do.

PR install/57885


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.57 src/usr.sbin/postinstall/postinstall.in:1.58
--- src/usr.sbin/postinstall/postinstall.in:1.57	Wed Oct 18 13:10:34 2023
+++ src/usr.sbin/postinstall/postinstall.in	Mon Jan 29 00:57:38 2024
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.57 2023/10/18 13:10:34 riastradh Exp $
+# $NetBSD: postinstall.in,v 1.58 2024/01/29 00:57:38 riastradh Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1685,7 +1685,6 @@ do_opensslcertsconf()
 	fix)	# If /etc/openssl/certs.conf is already there, nothing
 		# to do.
 		if [ -r "$certsconf" ]; then
-			msg "/etc/openssl/certs.conf already exists"
 			return 0
 		fi
 



CVS commit: src/usr.sbin/postinstall

2024-01-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jan 29 00:57:38 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall(8): Don't say /etc/openssl/certs.conf already exists.

It's confusing when all the other `postinstall fix' actions are
silent in the event they don't have anything to do.

PR install/57885


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2023-10-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Oct 18 13:10:34 UTC 2023

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall(8): Use /usr/sbin/certctl.

Obviates need to have /usr/sbin in PATH when running this.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2023-10-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Oct 18 13:10:34 UTC 2023

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall(8): Use /usr/sbin/certctl.

Obviates need to have /usr/sbin in PATH when running this.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.56 src/usr.sbin/postinstall/postinstall.in:1.57
--- src/usr.sbin/postinstall/postinstall.in:1.56	Wed Sep  6 13:38:54 2023
+++ src/usr.sbin/postinstall/postinstall.in	Wed Oct 18 13:10:34 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.56 2023/09/06 13:38:54 riastradh Exp $
+# $NetBSD: postinstall.in,v 1.57 2023/10/18 13:10:34 riastradh Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1763,7 +1763,7 @@ do_opensslcertsrehash()
 	check)	# Create a scratch rehash for comparison.
 		mtreekeys="type,link"
 		scratchdir="${SCRATCHDIR}/opensslcerts"
-		certctl -c "$scratchdir" rehash || return $?
+		/usr/sbin/certctl -c "$scratchdir" rehash || return $?
 
 		# This will create ${scratchdir}/.certctl unless the
 		# configuration is manual.  If the configuration is
@@ -1782,7 +1782,7 @@ do_opensslcertsrehash()
 		# that we report a failure if /etc/openssl/certs
 		# appears to be managed manually, but `manual' was not
 		# specified in /etc/openssl/certs.conf.
-		certctl -n rehash || return $?
+		/usr/sbin/certctl -n rehash || return $?
 
 		# Compare the trees with mtree(8).  Inconveniently,
 		# mtree returns status zero even if there are missing
@@ -1810,7 +1810,7 @@ do_opensslcertsrehash()
 			return 1
 			;;
 		esac
-		certctl rehash
+		/usr/sbin/certctl rehash
 		;;
 	*)	err 3 "USAGE: do_opensslcerts fix|check"
 		;;



CVS commit: src/usr.sbin/postinstall

2023-09-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Sep  6 13:38:54 UTC 2023

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall(8): Modify default certs.conf.

When manually configured /etc/openssl/certs is detected, just
uncomment the `#manual' line in the default certs.conf rather than
writing a new one.  That way, you can switch to certctl-managed and
still get the default path by just deleting /etc/openssl/certs and
re-commenting the `manual' line.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.55 src/usr.sbin/postinstall/postinstall.in:1.56
--- src/usr.sbin/postinstall/postinstall.in:1.55	Sun Sep  3 18:31:36 2023
+++ src/usr.sbin/postinstall/postinstall.in	Wed Sep  6 13:38:54 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.55 2023/09/03 18:31:36 riastradh Exp $
+# $NetBSD: postinstall.in,v 1.56 2023/09/06 13:38:54 riastradh Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1668,7 +1668,7 @@ do_named()
 additem opensslcertsconf "ensure TLS trust anchor configuration exists"
 do_opensslcertsconf()
 {
-	local certsdir certsconf defaultconf
+	local certsdir certsconf defaultconf manualmsg
 
 	[ -n "$1" ] || err 3 "USAGE: do_opensslcertsconf fix|check"
 
@@ -1701,15 +1701,40 @@ do_opensslcertsconf()
 			-maxdepth 0 -type d -empty -exit 1)
 		then
 			msg "/etc/openssl/certs appears manually configured"
-			cat <${certsconf}.tmp
-netbsd-certctl 20230816
-
-# existing /etc/openssl/certs configuration detected by postinstall(8)
-manual
-EOF
+			manualmsg="[existing /etc/openssl/certs configuration"
+			manualmsg="$manualmsg detected by postinstall(8)]"
+# Change the commented-out `#manual' line to
+# uncommented `manual', or print an error
+# message if there is no `#manual' line and put
+# `manual' at the end.
+awk -v defaultconf="$defaultconf" \
+			-v manualmsg="$manualmsg" '
+BEGIN {
+	manual = 0
+}
+/^#manual/ && !manual {
+	manual = 1
+	sub(/^#/, "")
+	print
+	print "#", manualmsg
+	next
+}
+{
+	print
+}
+END {
+	if (!manual) {
+		printf "warning: %s %s?\n", \
+		"corrupt", defaultconf \
+		>"/dev/stderr"
+		print "manual"
+		print "#", manualmsg
+	}
+}
+			' <$defaultconf >${certsconf}.tmp
 		else
 			msg "installing default /etc/openssl/certs.conf"
-			cp -- "$defaultconf" "${certsconf}.tmp"
+			cat <$defaultconf >${certsconf}.tmp
 		fi && mv -f -- "${certsconf}.tmp" "$certsconf"
 		;;
 	*)	err 3 "USAGE: do_opensslcerts fix|check"



CVS commit: src/usr.sbin/postinstall

2023-09-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Sep  6 13:38:54 UTC 2023

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall(8): Modify default certs.conf.

When manually configured /etc/openssl/certs is detected, just
uncomment the `#manual' line in the default certs.conf rather than
writing a new one.  That way, you can switch to certctl-managed and
still get the default path by just deleting /etc/openssl/certs and
re-commenting the `manual' line.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2023-09-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  3 18:31:36 UTC 2023

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall(8): Handle various certs.conf scenarios gracefully.

Tested the following scenarios:

1. fresh install
   empty /etc/openssl/certs
   default /etc/openssl/certs.conf
   - opensslcertsconf
 [x] check: pass
 [x] fix: pass -- nothing
   - opensslcertsrehash
 [x] check: fail -- needs rehash
 [x] fix: pass -- quietly rehash successfully (go to 4)

2. fresh upgrade
   empty /etc/openssl/certs
   no /etc/openssl/certs.conf
   - opensslcertsconf
 [x] check: fail -- complain missing /etc/openssl/certs.conf
 [x] fix: pass -- install default /etc/openssl/certs.conf (go to 1)
   - opensslcertsrehash
 [x] check: fail -- complain missing /etc/openssl/certs.conf
 - [x] fix: fail -- complain missing /etc/openssl/certs.conf

3. upgrade from certctl, changes to certs
   certctl-managed /etc/openssl/certs
   default /etc/openssl/certs.conf
   - opensslcertsconf
 [x] check: pass
 [x] fix: pass -- nothing
   - opensslcertsrehash
 [x] check: fail -- needs rehash
 [x] fix: pass -- quietly rehash successfully (go to 4)

4. upgrade from certctl, no changes to certs
   certctl-managed /etc/openssl/certs
   default /etc/openssl/certs.conf
   - opensslcertsconf
 [x] check: pass
 [x] fix: pass -- nothing
   - opensslcertsrehash
 [x] check: pass
 [x] fix: pass -- quietly rehash successfully (go to 4)

5. upgrade from mozilla-rootcerts
   populated /etc/openssl/certs
   no /etc/openssl/certs.conf
   - opensslcertsconf:
 [x] check: fail -- complain missing /etc/openssl/certs.conf
 [x] fix: pass -- install manual /etc/openssl/certs.conf (go to 7)
   - opensslcertsrehash:
 [x] check: fail -- complain missing /etc/openssl/certs.conf
 [x] fix: fail -- complain missing /etc/openssl/certs.conf

6. upgrade from mozilla-rootcerts with etcupdate naively
   populated /etc/openssl/certs
   default /etc/openssl/certs.conf
   - opensslcertsconf:
 [x] check: pass
 [x] fix: pass -- nothing
   - opensslcertsrehash:
 [x] check: fail -- complain mismatched certs/ and certs.conf
 [x] fix: fail -- complain mismatched certs/ and certs.conf

7. upgrade from mozilla-rootcerts with etcupdate manually
   populated /etc/openssl/certs
   manual /etc/openssl/certs.conf
   - opensslcertsconf:
 [x] check: pass
 [x] fix: pass -- nothing
   - opensslcertsrehash:
 [x] check: pass
 [x] fix: pass -- skip rehash because manual (go to 7)

XXX Someone should draft automatic tests for postinstall.  It has a
very good track record, but it sure would be nice to automate this
testing rather than redo it each time I make a tiny change.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2023-09-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  3 18:31:36 UTC 2023

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall(8): Handle various certs.conf scenarios gracefully.

Tested the following scenarios:

1. fresh install
   empty /etc/openssl/certs
   default /etc/openssl/certs.conf
   - opensslcertsconf
 [x] check: pass
 [x] fix: pass -- nothing
   - opensslcertsrehash
 [x] check: fail -- needs rehash
 [x] fix: pass -- quietly rehash successfully (go to 4)

2. fresh upgrade
   empty /etc/openssl/certs
   no /etc/openssl/certs.conf
   - opensslcertsconf
 [x] check: fail -- complain missing /etc/openssl/certs.conf
 [x] fix: pass -- install default /etc/openssl/certs.conf (go to 1)
   - opensslcertsrehash
 [x] check: fail -- complain missing /etc/openssl/certs.conf
 - [x] fix: fail -- complain missing /etc/openssl/certs.conf

3. upgrade from certctl, changes to certs
   certctl-managed /etc/openssl/certs
   default /etc/openssl/certs.conf
   - opensslcertsconf
 [x] check: pass
 [x] fix: pass -- nothing
   - opensslcertsrehash
 [x] check: fail -- needs rehash
 [x] fix: pass -- quietly rehash successfully (go to 4)

4. upgrade from certctl, no changes to certs
   certctl-managed /etc/openssl/certs
   default /etc/openssl/certs.conf
   - opensslcertsconf
 [x] check: pass
 [x] fix: pass -- nothing
   - opensslcertsrehash
 [x] check: pass
 [x] fix: pass -- quietly rehash successfully (go to 4)

5. upgrade from mozilla-rootcerts
   populated /etc/openssl/certs
   no /etc/openssl/certs.conf
   - opensslcertsconf:
 [x] check: fail -- complain missing /etc/openssl/certs.conf
 [x] fix: pass -- install manual /etc/openssl/certs.conf (go to 7)
   - opensslcertsrehash:
 [x] check: fail -- complain missing /etc/openssl/certs.conf
 [x] fix: fail -- complain missing /etc/openssl/certs.conf

6. upgrade from mozilla-rootcerts with etcupdate naively
   populated /etc/openssl/certs
   default /etc/openssl/certs.conf
   - opensslcertsconf:
 [x] check: pass
 [x] fix: pass -- nothing
   - opensslcertsrehash:
 [x] check: fail -- complain mismatched certs/ and certs.conf
 [x] fix: fail -- complain mismatched certs/ and certs.conf

7. upgrade from mozilla-rootcerts with etcupdate manually
   populated /etc/openssl/certs
   manual /etc/openssl/certs.conf
   - opensslcertsconf:
 [x] check: pass
 [x] fix: pass -- nothing
   - opensslcertsrehash:
 [x] check: pass
 [x] fix: pass -- skip rehash because manual (go to 7)

XXX Someone should draft automatic tests for postinstall.  It has a
very good track record, but it sure would be nice to automate this
testing rather than redo it each time I make a tiny change.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.54 src/usr.sbin/postinstall/postinstall.in:1.55
--- src/usr.sbin/postinstall/postinstall.in:1.54	Mon Aug 28 23:57:08 2023
+++ src/usr.sbin/postinstall/postinstall.in	Sun Sep  3 18:31:36 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.54 2023/08/28 23:57:08 riastradh Exp $
+# $NetBSD: postinstall.in,v 1.55 2023/09/03 18:31:36 riastradh Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1662,24 +1662,126 @@ do_named()
 
 
 #
-#	opensslcerts
+#	opensslcertsconf
 #
 
-additem opensslcerts "build /etc/openssl/certs cache of HTTPS CA certificates"
-do_opensslcerts()
+additem opensslcertsconf "ensure TLS trust anchor configuration exists"
+do_opensslcertsconf()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_opensslcerts fix|check"
+	local certsdir certsconf defaultconf
+
+	[ -n "$1" ] || err 3 "USAGE: do_opensslcertsconf fix|check"
+
+	certsdir="${DEST_DIR}/etc/openssl/certs"
+	certsconf="${DEST_DIR}/etc/openssl/certs.conf"
+	defaultconf="${DEST_DIR}/usr/share/examples/certctl/certs.conf"
 
 	case $1 in
-	check)	# XXX Anything to check?
-		return 0
+	check)	if [ ! -r "$certsconf" ]; then
+			msg "/etc/openssl/certs.conf missing; see certctl(8)"
+			return 1
+		fi
+		;;
+	fix)	# If /etc/openssl/certs.conf is already there, nothing
+		# to do.
+		if [ -r "$certsconf" ]; then
+			msg "/etc/openssl/certs.conf already exists"
+			return 0
+		fi
+
+		# If /etc/openssl/certs is a symlink, or exists but is
+		# not a directory, or is a directory but is nonempty,
+		# then either it's managed by someone else or something
+		# fishy is afoot.  So set it manual in that case.
+		# Otherwise, install the default config file.
+		if [ -h "$certsdir" ] ||
+		[ -e "$certsdir" -a ! -d "$certsdir" ] ||
+		([ -d "$certsdir" ] &&
+			find -f "$certsdir" -- \
+			-maxdepth 0 -type d -empty -exit 1)
+		

CVS commit: src/usr.sbin/postinstall

2023-08-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 28 23:57:08 UTC 2023

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall(8): Fail if `certctl rehash' fails.

Not using `set -e' here, evidently (maybe we should), so the separate
return 0 suppressed the error.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.53 src/usr.sbin/postinstall/postinstall.in:1.54
--- src/usr.sbin/postinstall/postinstall.in:1.53	Sat Aug 26 05:59:00 2023
+++ src/usr.sbin/postinstall/postinstall.in	Mon Aug 28 23:57:08 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.53 2023/08/26 05:59:00 riastradh Exp $
+# $NetBSD: postinstall.in,v 1.54 2023/08/28 23:57:08 riastradh Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1684,7 +1684,6 @@ do_opensslcerts()
 			;;
 		esac
 		certctl rehash
-		return 0
 		;;
 	*)	err 3 "USAGE: do_opensslcerts fix|check"
 		;;



CVS commit: src/usr.sbin/postinstall

2023-08-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 28 23:57:08 UTC 2023

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall(8): Fail if `certctl rehash' fails.

Not using `set -e' here, evidently (maybe we should), so the separate
return 0 suppressed the error.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2023-08-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 26 05:59:00 UTC 2023

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall(8): Add opensslcerts item to regen /etc/openssl/certs.

Works only with destdir /, since it relies on running openssl(1),
which is not available as a tool or required in the cross-build
environment.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2023-08-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 26 05:59:00 UTC 2023

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall(8): Add opensslcerts item to regen /etc/openssl/certs.

Works only with destdir /, since it relies on running openssl(1),
which is not available as a tool or required in the cross-build
environment.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.52 src/usr.sbin/postinstall/postinstall.in:1.53
--- src/usr.sbin/postinstall/postinstall.in:1.52	Wed Jun 21 18:46:06 2023
+++ src/usr.sbin/postinstall/postinstall.in	Sat Aug 26 05:59:00 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.52 2023/06/21 18:46:06 mrg Exp $
+# $NetBSD: postinstall.in,v 1.53 2023/08/26 05:59:00 riastradh Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1662,6 +1662,37 @@ do_named()
 
 
 #
+#	opensslcerts
+#
+
+additem opensslcerts "build /etc/openssl/certs cache of HTTPS CA certificates"
+do_opensslcerts()
+{
+	[ -n "$1" ] || err 3 "USAGE: do_opensslcerts fix|check"
+
+	case $1 in
+	check)	# XXX Anything to check?
+		return 0
+		;;
+	fix)	# This runs openssl(1), which is not available as a
+		# build-time tool.  So for now, restrict it to running
+		# on the installed system.
+		case $DEST_DIR in
+		''|/)	;;
+		*)	msg "opensslcerts limited to DEST_DIR=/"
+			return 1
+			;;
+		esac
+		certctl rehash
+		return 0
+		;;
+	*)	err 3 "USAGE: do_opensslcerts fix|check"
+		;;
+	esac
+}
+
+
+#
 #	pam
 #
 



CVS commit: src/usr.sbin/postinstall

2023-06-21 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jun 21 18:46:06 UTC 2023

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
adjust for new fontconfig files.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2023-06-21 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jun 21 18:46:06 UTC 2023

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
adjust for new fontconfig files.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.51 src/usr.sbin/postinstall/postinstall.in:1.52
--- src/usr.sbin/postinstall/postinstall.in:1.51	Sun May 29 10:47:40 2022
+++ src/usr.sbin/postinstall/postinstall.in	Wed Jun 21 18:46:06 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.51 2022/05/29 10:47:40 andvar Exp $
+# $NetBSD: postinstall.in,v 1.52 2023/06/21 18:46:06 mrg Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1318,9 +1318,9 @@ do_fontconfig()
 	fi
 	local regular_fonts="
 10-autohint.conf
-10-no-sub-pixel.conf
 10-scale-bitmap-fonts.conf
 10-sub-pixel-bgr.conf
+10-sub-pixel-none.conf
 10-sub-pixel-rgb.conf
 10-sub-pixel-vbgr.conf
 10-sub-pixel-vrgb.conf



CVS commit: src/usr.sbin/postinstall

2022-01-08 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 23:57:32 UTC 2022

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

Log Message:
postinstall(8); add -?. expand operation usage


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/postinstall/postinstall.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/postinstall/postinstall.8
diff -u src/usr.sbin/postinstall/postinstall.8:1.20 src/usr.sbin/postinstall/postinstall.8:1.21
--- src/usr.sbin/postinstall/postinstall.8:1.20	Wed Nov 21 20:13:09 2018
+++ src/usr.sbin/postinstall/postinstall.8	Sat Jan  8 23:57:32 2022
@@ -1,6 +1,6 @@
-.\"	$NetBSD: postinstall.8,v 1.20 2018/11/21 20:13:09 martin Exp $
+.\"	$NetBSD: postinstall.8,v 1.21 2022/01/08 23:57:32 lukem Exp $
 .\"
-.\" Copyright (c) 2005-2008 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2005-2022 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -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 November 20, 2018
+.Dd January 9, 2022
 .Dt POSTINSTALL 8
 .Os
 .Sh NAME
@@ -38,10 +38,12 @@
 .Op Fl a Ar arch
 .Op Fl d Ar destdir
 .Op Fl m Ar machine
-.Op Fl s Brq Ar srcdir | Ar tgzdir | Ar tgzfile
+.Op Fl s Pq Ar srcdir | Ar tgzdir | Ar tgzfile
 .Op Fl x Ar xsrcdir
 .Ar operation
-.Op Ar item Op ...
+.Ar \&...
+.Nm postinstall
+.Fl \&?
 .Sh DESCRIPTION
 The
 .Nm
@@ -73,7 +75,7 @@ Defaults to
 .It Fl m Ar machine
 MACHINE.
 Defaults to machine of the host operating system.
-.It Fl s Brq Ar srcdir | Ar tgzdir | Ar tgzfile
+.It Fl s Pq Ar srcdir | Ar tgzdir | Ar tgzfile
 The location of the reference files, or the
 .Nx
 source files used to create the reference files.
@@ -130,19 +132,21 @@ Location of the X11 source files.
 This must be a directory that contains a
 .Nx
 xsrc tree.
+.It Fl \&?
+Display help to stdout, and exit.
 .El
 .Pp
 The
 .Ar operation
 argument may be one of:
 .Bl -tag -width usageXX -offset indent
-.It Cm check
+.It Cm check Ar item Ar \&...
 Perform post-installation checks on items.
-.It Cm diff Op Xr diff 1 Li options
+.It Cm diff Oo Fl Ar bcenpuw Oc Ar item Ar \&...
 Similar to
 .Cm check ,
 but also show the differences between the files.
-.It Cm fix
+.It Cm fix Ar item Ar \&...
 Apply fixes that
 .Cm check
 determines need to be applied.
@@ -160,14 +164,13 @@ See
 .Xr etcupdate 8
 for an alternative update method that is able to merge files.
 .It Cm help
-Display a short help.
+Display help to stdout, and exit.
 .It Cm list
 List available
 .Ar items ,
 showing if they are enabled or disabled by default.
 .It Cm usage
-Same as
-.Cm help .
+Display help to stdout, and exit.
 .El
 .Sh EXIT STATUS
 The



CVS commit: src/usr.sbin/postinstall

2022-01-08 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 23:57:32 UTC 2022

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

Log Message:
postinstall(8); add -?. expand operation usage


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

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2022-01-08 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 23:30:42 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: improve -s usage

Reword -s SRC_ARG to be a bit clearer as to the variations, and sync
more with postinstall(8).


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.49 src/usr.sbin/postinstall/postinstall.in:1.50
--- src/usr.sbin/postinstall/postinstall.in:1.49	Sat Jan  8 23:07:17 2022
+++ src/usr.sbin/postinstall/postinstall.in	Sat Jan  8 23:30:41 2022
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.49 2022/01/08 23:07:17 lukem Exp $
+# $NetBSD: postinstall.in,v 1.50 2022/01/08 23:30:41 lukem Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2541,7 +2541,7 @@ do_obsolete()
 help()
 {
 	cat << _USAGE_
-Usage: ${PROGNAME} [-a ARCH] [-d DEST_DIR] [-m MACHINE] [-s SRC_DIR] [-x XSRC_DIR] OPERATION ...
+Usage: ${PROGNAME} [-a ARCH] [-d DEST_DIR] [-m MACHINE] [-s SRC_ARG] [-x XSRC_DIR] OPERATION ...
${PROGNAME} -?
 
 	Perform post-installation checks and/or fixes on a system's
@@ -2553,14 +2553,16 @@ Usage: ${PROGNAME} [-a ARCH] [-d DEST_DI
 	-a ARCH		Set \$MACHINE_ARCH to ARCH.	[${MACHINE_ARCH}]
 	-d DEST_DIR	Destination directory to check. [${DEST_DIR:-/}]
 	-m MACHINE	Set \$MACHINE to MACHINE.	[${MACHINE}]
-	-s SRC_DIR	Location of the source files.  This may be any of
+	-s SRC_ARG	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".  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.
+			-s SRC_DIR	A directory that contains a NetBSD
+	source tree.
+			-s TGZ_DIR	A directory in which one or both of
+	"etc.tgz" and "xetc.tgz" have been
+	extracted.
+			-s TGZ_FILE	A distribution set file such as
+	"etc.tgz" or "xetc.tgz".
+	May be specified multipled times.
 			[${SRC_DIR:-/usr/src}]
 	-x XSRC_DIR	Location of the X11 source files.  This must be
 			a directory that contains a NetBSD xsrc tree.



CVS commit: src/usr.sbin/postinstall

2022-01-08 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 23:30:42 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: improve -s usage

Reword -s SRC_ARG to be a bit clearer as to the variations, and sync
more with postinstall(8).


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2022-01-08 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 23:07:17 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: tweak -a and -m usage


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2022-01-08 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 23:07:17 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: tweak -a and -m usage


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.48 src/usr.sbin/postinstall/postinstall.in:1.49
--- src/usr.sbin/postinstall/postinstall.in:1.48	Sat Jan  8 23:04:11 2022
+++ src/usr.sbin/postinstall/postinstall.in	Sat Jan  8 23:07:17 2022
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.48 2022/01/08 23:04:11 lukem Exp $
+# $NetBSD: postinstall.in,v 1.49 2022/01/08 23:07:17 lukem Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2550,9 +2550,9 @@ Usage: ${PROGNAME} [-a ARCH] [-d DEST_DI
 
 	Options:
 	-?		Display this help, and exit.
-	-a ARCH		\$MACHINE_ARCH.			[${MACHINE_ARCH}]
+	-a ARCH		Set \$MACHINE_ARCH to ARCH.	[${MACHINE_ARCH}]
 	-d DEST_DIR	Destination directory to check. [${DEST_DIR:-/}]
-	-m MACHINE	\$MACHINE.			[${MACHINE}]
+	-m MACHINE	Set \$MACHINE to MACHINE.	[${MACHINE}]
 	-s SRC_DIR	Location of the source files.  This may be any of
 			the following:
 			* A directory that contains a NetBSD source tree;



CVS commit: src/usr.sbin/postinstall

2022-01-08 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 23:04:11 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: add -? to usage


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.47 src/usr.sbin/postinstall/postinstall.in:1.48
--- src/usr.sbin/postinstall/postinstall.in:1.47	Sat Jan  8 06:58:40 2022
+++ src/usr.sbin/postinstall/postinstall.in	Sat Jan  8 23:04:11 2022
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.47 2022/01/08 06:58:40 lukem Exp $
+# $NetBSD: postinstall.in,v 1.48 2022/01/08 23:04:11 lukem Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2549,6 +2549,7 @@ Usage: ${PROGNAME} [-a ARCH] [-d DEST_DI
 	If no items are provided, a default set of checks or fixes is applied.
 
 	Options:
+	-?		Display this help, and exit.
 	-a ARCH		\$MACHINE_ARCH.			[${MACHINE_ARCH}]
 	-d DEST_DIR	Destination directory to check. [${DEST_DIR:-/}]
 	-m MACHINE	\$MACHINE.			[${MACHINE}]
@@ -2566,14 +2567,14 @@ Usage: ${PROGNAME} [-a ARCH] [-d DEST_DI
 			[${XSRC_DIR:-/usr/src/../xsrc}]
 
 	Supported values for OPERATION:
-	help		Display this help.
+	help		Display this help, and exit.
 	list		List available items.
 	check ITEM ...	Perform post-installation checks on ITEMs.
 	diff [-bcenpuw] ITEM ...
 			Similar to 'check' but also output difference of files,
 			using diff with the provided options.
 	fix ITEM ...	Apply fixes that 'check' determines need to be applied.
-	usage		Display this usage.
+	usage		Display this help, and exit.
 _USAGE_
 }
 



CVS commit: src/usr.sbin/postinstall

2022-01-08 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 23:04:11 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: add -? to usage


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2022-01-07 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 06:58:40 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: add -?. improve option errors

Support -? to show help.
Implemented using getopts "leading colon optstring" feature.
Improve error messages for unknown options and missing arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.46 src/usr.sbin/postinstall/postinstall.in:1.47
--- src/usr.sbin/postinstall/postinstall.in:1.46	Sat Jan  8 06:57:34 2022
+++ src/usr.sbin/postinstall/postinstall.in	Sat Jan  8 06:58:40 2022
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.46 2022/01/08 06:57:34 lukem Exp $
+# $NetBSD: postinstall.in,v 1.47 2022/01/08 06:58:40 lukem Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2542,6 +2542,8 @@ help()
 {
 	cat << _USAGE_
 Usage: ${PROGNAME} [-a ARCH] [-d DEST_DIR] [-m MACHINE] [-s SRC_DIR] [-x XSRC_DIR] OPERATION ...
+   ${PROGNAME} -?
+
 	Perform post-installation checks and/or fixes on a system's
 	configuration files.
 	If no items are provided, a default set of checks or fixes is applied.
@@ -2567,9 +2569,9 @@ Usage: ${PROGNAME} [-a ARCH] [-d DEST_DI
 	help		Display this help.
 	list		List available items.
 	check ITEM ...	Perform post-installation checks on ITEMs.
-	diff [DIFFOPT] ITEM ...
+	diff [-bcenpuw] ITEM ...
 			Similar to 'check' but also output difference of files,
-			using diff [DIFFOPT].
+			using diff with the provided options.
 	fix ITEM ...	Apply fixes that 'check' determines need to be applied.
 	usage		Display this usage.
 _USAGE_
@@ -2626,7 +2628,7 @@ main()
 
 		# Validate options.
 		#
-	while getopts a:d:m:s:x: ch; do
+	while getopts :a:d:m:s:x: ch; do
 		case "${ch}" in
 		a)
 			MACHINE_ARCH="${OPTARG}"
@@ -2675,9 +2677,23 @@ main()
 err 2 "Not a directory for -x option"
 			fi
 			;;
-		*)
+		"?")
+			if [ "${OPTARG}" = "?" ]; then
+help
+return	# no further processing or validation
+			fi
+			warn "Unknown option -${OPTARG}"
+			usage
+			;;
+
+		:)
+			warn "Missing argument for option -${OPTARG}"
 			usage
 			;;
+
+		*)
+			err 3 "Unimplemented option -${ch}"
+			;;
 		esac
 	done
 	shift $((${OPTIND} - 1))
@@ -2706,20 +2722,30 @@ main()
 		op=check
 		DIFF_STYLE=n			# default style is RCS
 		OPTIND=1
-		while getopts bcenpuw ch; do
+		while getopts :bcenpuw ch; do
 			case "${ch}" in
 			c|e|n|u)
 if [ "${DIFF_STYLE}" != "n" -a \
 "${DIFF_STYLE}" != "${ch}" ]; then
-	err 2 "diff: conflicting output style: ${ch}"
+	warn "diff: conflicting output style: -${ch}"
+	usage
 fi
 DIFF_STYLE="${ch}"
 ;;
 			b|p|w)
 DIFF_OPT="${DIFF_OPT} -${ch}"
 ;;
+			"?")
+# NOTE: not supporting diff -?
+warn "diff: Unknown option -${OPTARG}"
+usage
+;;
+			:)
+warn "diff: Missing argument for option -${OPTARG}"
+usage
+;;
 			*)
-err 2 "diff: unknown option"
+err 3 "diff: Unimplemented option -${ch}"
 ;;
 			esac
 		done



CVS commit: src/usr.sbin/postinstall

2022-01-07 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 06:58:40 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: add -?. improve option errors

Support -? to show help.
Implemented using getopts "leading colon optstring" feature.
Improve error messages for unknown options and missing arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2022-01-07 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 06:57:34 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: usage improvements

Show options alphabetically.
Use UPPER_CASE instead of lowercase as the convention for argument names.
Provide per-OPERATION argument usage.
Implement options alphabetically.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.45 src/usr.sbin/postinstall/postinstall.in:1.46
--- src/usr.sbin/postinstall/postinstall.in:1.45	Sat Jan  8 06:56:43 2022
+++ src/usr.sbin/postinstall/postinstall.in	Sat Jan  8 06:57:34 2022
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.45 2022/01/08 06:56:43 lukem Exp $
+# $NetBSD: postinstall.in,v 1.46 2022/01/08 06:57:34 lukem Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2541,15 +2541,17 @@ do_obsolete()
 help()
 {
 	cat << _USAGE_
-Usage: ${PROGNAME} [-s srcdir] [-x xsrcdir] [-d destdir] [-m mach] [-a arch] operation [item ...]
+Usage: ${PROGNAME} [-a ARCH] [-d DEST_DIR] [-m MACHINE] [-s SRC_DIR] [-x XSRC_DIR] OPERATION ...
 	Perform post-installation checks and/or fixes on a system's
 	configuration files.
 	If no items are provided, a default set of checks or fixes is applied.
 
 	Options:
-	-s {srcdir|tgzfile|tempdir}
-			Location of the source files.  This may be any
-			of the following:
+	-a ARCH		\$MACHINE_ARCH.			[${MACHINE_ARCH}]
+	-d DEST_DIR	Destination directory to check. [${DEST_DIR:-/}]
+	-m MACHINE	\$MACHINE.			[${MACHINE}]
+	-s SRC_DIR	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".  Pass multiple -s options to specify
@@ -2557,21 +2559,19 @@ Usage: ${PROGNAME} [-s srcdir] [-x xsrcd
 			* A temporary directory in which one or both of
 			  "etc.tgz" and "xetc.tgz" have been extracted.
 			[${SRC_DIR:-/usr/src}]
-	-x xsrcdir  Location of the X11 source files.  This must be
+	-x XSRC_DIR	Location of the X11 source files.  This must be
 			a directory that contains a NetBSD xsrc tree.
 			[${XSRC_DIR:-/usr/src/../xsrc}]
-	-d destdir	Destination directory to check. [${DEST_DIR:-/}]
-	-m mach		MACHINE.			[${MACHINE}]
-	-a arch		MACHINE_ARCH.			[${MACHINE_ARCH}]
-
-	Supported values for operation:
-		help	Display this help.
-		list	List available items.
-		check	Perform post-installation checks on items.
-		diff [diff(1) options ...]
-			Similar to 'check' but also output difference of files.
-		fix	Apply fixes that 'check' determines need to be applied.
-		usage	Display this usage.
+
+	Supported values for OPERATION:
+	help		Display this help.
+	list		List available items.
+	check ITEM ...	Perform post-installation checks on ITEMs.
+	diff [DIFFOPT] ITEM ...
+			Similar to 'check' but also output difference of files,
+			using diff [DIFFOPT].
+	fix ITEM ...	Apply fixes that 'check' determines need to be applied.
+	usage		Display this usage.
 _USAGE_
 }
 
@@ -2626,8 +2626,17 @@ main()
 
 		# Validate options.
 		#
-	while getopts s:x:d:m:a: ch; do
+	while getopts a:d:m:s:x: ch; do
 		case "${ch}" in
+		a)
+			MACHINE_ARCH="${OPTARG}"
+			;;
+		d)
+			DEST_DIR="${OPTARG}"
+			;;
+		m)
+			MACHINE="${OPTARG}"
+			;;
 		s)
 			qarg="$(shell_quote "${OPTARG}")"
 			N_SRC_ARGS=$(( $N_SRC_ARGS + 1 ))
@@ -2666,15 +2675,6 @@ main()
 err 2 "Not a directory for -x option"
 			fi
 			;;
-		d)
-			DEST_DIR="${OPTARG}"
-			;;
-		m)
-			MACHINE="${OPTARG}"
-			;;
-		a)
-			MACHINE_ARCH="${OPTARG}"
-			;;
 		*)
 			usage
 			;;



CVS commit: src/usr.sbin/postinstall

2022-01-07 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 06:57:34 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: usage improvements

Show options alphabetically.
Use UPPER_CASE instead of lowercase as the convention for argument names.
Provide per-OPERATION argument usage.
Implement options alphabetically.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2022-01-07 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 06:56:43 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: improve validation and help

Validate the operation and items before extracting any etc.tgz,
so that help or errors are displayed quicker, for a better user
experience.

Style:
- Rename todo to ITEMS.
- Order processing of list after check.
- Ensure DIFF_OPT is initialised, for consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.44 src/usr.sbin/postinstall/postinstall.in:1.45
--- src/usr.sbin/postinstall/postinstall.in:1.44	Sat Jan  8 06:55:13 2022
+++ src/usr.sbin/postinstall/postinstall.in	Sat Jan  8 06:56:43 2022
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.44 2022/01/08 06:55:13 lukem Exp $
+# $NetBSD: postinstall.in,v 1.45 2022/01/08 06:56:43 lukem Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2598,13 +2598,13 @@ list()
 		eval desc=\"\${desc_${i}}\"
 		printf " %-20s %s\n" "${i}" "${desc}"
 	done
-
 }
 
 
 main()
 {
 	DIRMODE=false		# true if "-s" specified a directory
+	ITEMS=			# items to check|diff|fix. [${defaultitems}]
 	N_SRC_ARGS=0		# number of "-s" args in SRC_ARGLIST
 	SOURCEMODE=false	# true if "-s" specified a source directory
 	SRC_ARGLIST=		# quoted list of one or more "-s" args
@@ -2624,6 +2624,8 @@ main()
 		;;
 	esac
 
+		# Validate options.
+		#
 	while getopts s:x:d:m:a: ch; do
 		case "${ch}" in
 		s)
@@ -2683,6 +2685,8 @@ main()
 		warn "Missing operation"
 		usage
 	fi
+	op="$1"
+	shift
 
 	if [ "$N_SRC_ARGS" -gt 1 ] && $DIRMODE; then
 		err 2 "Multiple -s args are allowed only with tgz files"
@@ -2694,6 +2698,68 @@ main()
 		SRC_ARGLIST="-s $(shell_quote "${SRC_ARG}")"
 	fi
 
+		# Validate 'diff' first, as it becomes 'check'
+		#
+	case "${op}" in
+
+	diff)
+		op=check
+		DIFF_STYLE=n			# default style is RCS
+		OPTIND=1
+		while getopts bcenpuw ch; do
+			case "${ch}" in
+			c|e|n|u)
+if [ "${DIFF_STYLE}" != "n" -a \
+"${DIFF_STYLE}" != "${ch}" ]; then
+	err 2 "diff: conflicting output style: ${ch}"
+fi
+DIFF_STYLE="${ch}"
+;;
+			b|p|w)
+DIFF_OPT="${DIFF_OPT} -${ch}"
+;;
+			*)
+err 2 "diff: unknown option"
+;;
+			esac
+		done
+		shift $((${OPTIND} - 1))
+		;;
+
+	esac
+
+		# Validate operation and items.
+		#
+	case "${op}" in
+
+	check|fix)
+		ITEMS="$*"
+		: ${ITEMS:="${defaultitems}"}
+
+		# ensure that all supplied items are valid
+		#
+		for i in ${ITEMS}; do
+			eval desc=\"\${desc_${i}}\"
+			[ -n "${desc}" ] || err 2 "Unsupported ${op} '"${i}"'"
+		done
+		;;
+
+	help|usage)
+		help
+		return	# no further processing or validation
+		;;
+
+	list)
+		# processed below
+		;;
+
+	*)
+		warn "Unknown operation '"${op}"'"
+		usage
+		;;
+
+	esac
+
 	#
 	# If '-s' arg or args specified tgz files, extract them
 	# to a scratch directory.
@@ -2736,63 +2802,13 @@ main()
 
 	detect_x11
 
-	op="$1"
-	shift
-
-	case "${op}" in
-	diff)
-		op=check
-		DIFF_STYLE=n			# default style is RCS
-		OPTIND=1
-		while getopts bcenpuw ch; do
-			case "${ch}" in
-			c|e|n|u)
-if [ "${DIFF_STYLE}" != "n" -a \
-"${DIFF_STYLE}" != "${ch}" ]; then
-	err 2 "conflicting output style: ${ch}"
-fi
-DIFF_STYLE="${ch}"
-;;
-			b|p|w)
-DIFF_OPT="${DIFF_OPT} -${ch}"
-;;
-			*)
-err 2 "unknown diff option"
-;;
-			esac
-		done
-		shift $((${OPTIND} - 1))
-		;;
-	esac
-
+		# Perform operation.
+		#
 	case "${op}" in
 
-	usage|help)
-		help
-		;;
-
-	list)
-		echo "Source directory: ${SRC_DIR:-/}"
-		echo "Target directory: ${DEST_DIR:-/}"
-		if $TGZMODE; then
-			echo " (extracted from: ${SRC_ARG})"
-		fi
-		list
-		;;
-
 	check|fix)
-		todo="$*"
-		: ${todo:="${defaultitems}"}
-
-		# ensure that all supplied items are valid
-		#
-		for i in ${todo}; do
-			eval desc=\"\${desc_${i}}\"
-			[ -n "${desc}" ] || err 2 "Unsupported ${op} '"${i}"'"
-		done
+		[ -n "${ITEMS}" ] || err 2 "${op}: missing items"
 
-		# perform each check/fix
-		#
 		echo "Source directory: ${SRC_DIR:-/}"
 		if $TGZMODE; then
 			echo " (extracted from: ${SRC_ARG})"
@@ -2800,7 +2816,7 @@ main()
 		echo "Target directory: ${DEST_DIR:-/}"
 		items_passed=
 		items_failed=
-		for i in ${todo}; do
+		for i in ${ITEMS}; do
 			echo "${i} ${op}:"
 			( eval do_${i} ${op} )
 			if [ $? -eq 0 ]; then
@@ -2829,12 +2845,20 @@ Note that this may overwrite local chang
 _Fix_me_
 		fi
 		fi
+		;;
 
+	list)
+		echo "Source directory: ${SRC_DIR:-/}"
+		echo "Target directory: ${DEST_DIR:-/}"
+		if $TGZMODE; then
+			echo " (extracted from: ${SRC_ARG})"
+		fi
+		list
 		;;
 
 	*)
-		warn "Unknown operation '"${op}"'"
-		usage
+			# 

CVS commit: src/usr.sbin/postinstall

2022-01-07 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 06:55:13 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: style tweaks

Fix ... in comments and internal errors.
Sort variables declared at top of main(), for easier review.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.43 src/usr.sbin/postinstall/postinstall.in:1.44
--- src/usr.sbin/postinstall/postinstall.in:1.43	Sat Jan  8 06:53:58 2022
+++ src/usr.sbin/postinstall/postinstall.in	Sat Jan  8 06:55:13 2022
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.43 2022/01/08 06:53:58 lukem Exp $
+# $NetBSD: postinstall.in,v 1.44 2022/01/08 06:55:13 lukem Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -222,7 +222,7 @@ check_dir()
 	return 0
 }
 
-# check_ids op type file srcfile start id [...]
+# check_ids op type file srcfile start id ...
 #	Check if file of type "users" or "groups" contains the relevant IDs.
 #	Use srcfile as a reference for the expected contents.
 #	The specified "id" names should be given in numerical order,
@@ -233,7 +233,7 @@ check_dir()
 #
 check_ids()
 {
-	[ $# -ge 6 ] || err 3 "USAGE: checks_ids op type file start srcfile id [...]"
+	[ $# -ge 6 ] || err 3 "USAGE: checks_ids op type file start srcfile id ..."
 	_op="$1"
 	_type="$2"
 	_file="$3"
@@ -294,7 +294,7 @@ check_ids()
 	return 0
 }
 
-# populate_dir op onlynew src dest mode file [file ...]
+# populate_dir op onlynew src dest mode file ...
 #	Perform op ("check" or "fix") on files in src/ against dest/
 #	If op = "check" display missing or changed files, optionally with diffs.
 #	If op != "check" copies any missing or changed files.
@@ -303,7 +303,7 @@ check_ids()
 #
 populate_dir()
 {
-	[ $# -ge 5 ] || err 3 "USAGE: populate_dir op onlynew src dest mode file [...]"
+	[ $# -ge 5 ] || err 3 "USAGE: populate_dir op onlynew src dest mode file ..."
 	_op="$1"
 	_onlynew="$2"
 	_src="$3"
@@ -353,7 +353,7 @@ populate_dir()
 	return ${_cmpdir_rv}
 }
 
-# compare_dir op src dest mode file [file ...]
+# compare_dir op src dest mode file ...
 #	Perform op ("check" or "fix") on files in src/ against dest/
 #	If op = "check" display missing or changed files, optionally with diffs.
 #	If op != "check" copies any missing or changed files.
@@ -361,7 +361,7 @@ populate_dir()
 #
 compare_dir()
 {
-	[ $# -ge 4 ] || err 3 "USAGE: compare_dir op src dest mode file [...]"
+	[ $# -ge 4 ] || err 3 "USAGE: compare_dir op src dest mode file ..."
 	_op="$1"
 	_src="$2"
 	_dest="$3"
@@ -457,7 +457,7 @@ rcvar_is_enabled()
 	)
 }
 
-# find_file_in_dirlist() file message dir1 [...] --
+# find_file_in_dirlist() file message dir1 ... --
 #	Find which directory file is in, and sets ${dir} to match.
 #	Returns 0 if matched, otherwise 1 (and sets ${dir} to "").
 #
@@ -466,7 +466,7 @@ rcvar_is_enabled()
 #
 find_file_in_dirlist()
 {
-	[ $# -ge 3 ] || err 3 "USAGE: find_file_in_dirlist file msg dir1 [...]"
+	[ $# -ge 3 ] || err 3 "USAGE: find_file_in_dirlist file msg dir1 ..."
 
 	_file="$1" ; shift
 	_msg="$1" ; shift
@@ -756,12 +756,12 @@ contents_owner()
 	fi
 }
 
-# get_makevar var [var ...]
+# get_makevar var ...
 #	Retrieve the value of a user-settable system make variable
 get_makevar()
 {
 	$SOURCEMODE || err 3 "get_makevar must be used in source mode"
-	[ $# -eq 0 ] && err 3 "USAGE: get_makevar var [var ...]"
+	[ $# -eq 0 ] && err 3 "USAGE: get_makevar var ..."
 
 	for _var in "$@"; do
 		_value="$(echo '.include ' | \
@@ -2604,14 +2604,15 @@ list()
 
 main()
 {
-	TGZLIST=		# quoted list list of tgz files
+	DIRMODE=false		# true if "-s" specified a directory
+	N_SRC_ARGS=0		# number of "-s" args in SRC_ARGLIST
+	SOURCEMODE=false	# true if "-s" specified a source directory
 	SRC_ARGLIST=		# quoted list of one or more "-s" args
 	SRC_DIR="${SRC_ARG}"	# set default value for early usage()
-	XSRC_DIR="${SRC_ARG}/../xsrc"
-	N_SRC_ARGS=0		# number of "-s" args
+	TGZLIST=		# quoted list list of tgz files
 	TGZMODE=false		# true if "-s" specifies a tgz file
-	DIRMODE=false		# true if "-s" specified a directory
-	SOURCEMODE=false	# true if "-s" specified a source directory
+	XSRC_DIR="${SRC_ARG}/../xsrc"
+	XSRC_DIR_FIX=
 
 	case "$(uname -s)" in
 	Darwin)



CVS commit: src/usr.sbin/postinstall

2022-01-07 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 06:55:13 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: style tweaks

Fix ... in comments and internal errors.
Sort variables declared at top of main(), for easier review.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2022-01-07 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 06:53:58 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: help to stdout. usage tweaks

When invoked as "help" or "usage", send the usage to stdout
instead of stderr, so that it's easier to pipe to a pager.

Explicitly warn that the operation is missing.

Tweak the usage; "operation" instead of "op", no need for [] around ...


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.42 src/usr.sbin/postinstall/postinstall.in:1.43
--- src/usr.sbin/postinstall/postinstall.in:1.42	Fri Jan  7 01:03:02 2022
+++ src/usr.sbin/postinstall/postinstall.in	Sat Jan  8 06:53:58 2022
@@ -1,8 +1,8 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.42 2022/01/07 01:03:02 lukem Exp $
+# $NetBSD: postinstall.in,v 1.43 2022/01/08 06:53:58 lukem Exp $
 #
-# Copyright (c) 2002-2021 The NetBSD Foundation, Inc.
+# Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
 #
 # This code is derived from software contributed to The NetBSD Foundation
@@ -2538,10 +2538,10 @@ do_obsolete()
 #
 
 
-usage()
+help()
 {
-	cat 1>&2 << _USAGE_
-Usage: ${PROGNAME} [-s srcdir] [-x xsrcdir] [-d destdir] [-m mach] [-a arch] op [item [...]]
+	cat << _USAGE_
+Usage: ${PROGNAME} [-s srcdir] [-x xsrcdir] [-d destdir] [-m mach] [-a arch] operation [item ...]
 	Perform post-installation checks and/or fixes on a system's
 	configuration files.
 	If no items are provided, a default set of checks or fixes is applied.
@@ -2564,7 +2564,7 @@ Usage: ${PROGNAME} [-s srcdir] [-x xsrcd
 	-m mach		MACHINE.			[${MACHINE}]
 	-a arch		MACHINE_ARCH.			[${MACHINE_ARCH}]
 
-	Operation may be one of:
+	Supported values for operation:
 		help	Display this help.
 		list	List available items.
 		check	Perform post-installation checks on items.
@@ -2573,6 +2573,11 @@ Usage: ${PROGNAME} [-s srcdir] [-x xsrcd
 		fix	Apply fixes that 'check' determines need to be applied.
 		usage	Display this usage.
 _USAGE_
+}
+
+usage()
+{
+	help 1>&2
 	exit 2
 }
 
@@ -2673,7 +2678,10 @@ main()
 		esac
 	done
 	shift $((${OPTIND} - 1))
-	[ $# -gt 0 ] || usage
+	if [ $# -eq 0 ] ; then
+		warn "Missing operation"
+		usage
+	fi
 
 	if [ "$N_SRC_ARGS" -gt 1 ] && $DIRMODE; then
 		err 2 "Multiple -s args are allowed only with tgz files"
@@ -2759,7 +2767,7 @@ main()
 	case "${op}" in
 
 	usage|help)
-		usage
+		help
 		;;
 
 	list)



CVS commit: src/usr.sbin/postinstall

2022-01-07 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Jan  8 06:53:58 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: help to stdout. usage tweaks

When invoked as "help" or "usage", send the usage to stdout
instead of stderr, so that it's easier to pipe to a pager.

Explicitly warn that the operation is missing.

Tweak the usage; "operation" instead of "op", no need for [] around ...


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2022-01-06 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Fri Jan  7 01:03:02 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: fix x11 migration of /usr/X11R6/lib/X11

Fix the x11 check if /usr/X11R6/lib/X11/* needs to migrate to /etc/X11/*
by ensuring that the former actually is detected.

Avoids false migration errors for paths such as /fs if /usr/X11R6
doesn't exist, such as:
x11 check:
Migrate /fs to /etc/X11/fs

The original implemention handled this correctly, but the bug
crept in postinstall 1.110 on 2010/11/21.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.41 src/usr.sbin/postinstall/postinstall.in:1.42
--- src/usr.sbin/postinstall/postinstall.in:1.41	Sat Aug 21 10:06:33 2021
+++ src/usr.sbin/postinstall/postinstall.in	Fri Jan  7 01:03:02 2022
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.41 2021/08/21 10:06:33 andvar Exp $
+# $NetBSD: postinstall.in,v 1.42 2022/01/07 01:03:02 lukem Exp $
 #
 # Copyright (c) 2002-2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2300,6 +2300,7 @@ do_x11()
 
 	failed=0
 	_etcx11="${DEST_DIR}/etc/X11"
+	_libx11=""
 	if [ ! -d "${_etcx11}" ]; then
 		msg "${_etcx11} is not a directory; skipping check"
 		return 0
@@ -2318,30 +2319,33 @@ do_x11()
 		_notfixed="${NOT_FIXED}"
 	fi
 
-	for d in \
-		fs lbxproxy proxymngr rstart twm xdm xinit xserver xsm \
-	; do
-		sd="${_libx11}/${d}"
-		ld="/etc/X11/${d}"
-		td="${DEST_DIR}${ld}"
-		if [ -h "${sd}" ]; then
-			continue
-		elif [ -d "${sd}" ]; then
-			tdfiles="$(find "${td}" \! -type d)"
-			if [ -n "${tdfiles}" ]; then
-msg "${sd} exists yet ${td} already" \
-"contains files${_notfixed}"
+	# check if /usr/X11R6/lib/X11 needs to migrate to /etc/X11
+	if [ -n "${_libx11}" ]; then
+		for d in \
+			fs lbxproxy proxymngr rstart twm xdm xinit xserver xsm \
+		; do
+			sd="${_libx11}/${d}"
+			ld="/etc/X11/${d}"
+			td="${DEST_DIR}${ld}"
+			if [ -h "${sd}" ]; then
+continue
+			elif [ -d "${sd}" ]; then
+tdfiles="$(find "${td}" \! -type d)"
+if [ -n "${tdfiles}" ]; then
+	msg "${sd} exists yet ${td} already" \
+	"contains files${_notfixed}"
+else
+	msg "Migrate ${sd} to ${td}${_notfixed}"
+fi
+failed=1
+			elif [ -e "${sd}" ]; then
+msg "Unexpected file ${sd}${_notfixed}"
+continue
 			else
-msg "Migrate ${sd} to ${td}${_notfixed}"
+continue
 			fi
-			failed=1
-		elif [ -e "${sd}" ]; then
-			msg "Unexpected file ${sd}${_notfixed}"
-			continue
-		else
-			continue
-		fi
-	done
+		done
+	fi
 
 	# check if xdm resources have been updated
 	if [ -r ${_etcx11}/xdm/Xresources ] && \



CVS commit: src/usr.sbin/postinstall

2022-01-06 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Fri Jan  7 01:03:02 UTC 2022

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: fix x11 migration of /usr/X11R6/lib/X11

Fix the x11 check if /usr/X11R6/lib/X11/* needs to migrate to /etc/X11/*
by ensuring that the former actually is detected.

Avoids false migration errors for paths such as /fs if /usr/X11R6
doesn't exist, such as:
x11 check:
Migrate /fs to /etc/X11/fs

The original implemention handled this correctly, but the bug
crept in postinstall 1.110 on 2010/11/21.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2021-08-21 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Aug 21 10:06:33 UTC 2021

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
s/accidentaly/accidentally/


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.40 src/usr.sbin/postinstall/postinstall.in:1.41
--- src/usr.sbin/postinstall/postinstall.in:1.40	Sat Aug 21 09:59:47 2021
+++ src/usr.sbin/postinstall/postinstall.in	Sat Aug 21 10:06:33 2021
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.40 2021/08/21 09:59:47 andvar Exp $
+# $NetBSD: postinstall.in,v 1.41 2021/08/21 10:06:33 andvar Exp $
 #
 # Copyright (c) 2002-2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1243,7 +1243,7 @@ do_dhcpcd()
 #	dhcpcdrundir
 #
 
-additem dhcpcdrundir "accidentaly created /@RUNDIR@ does not exist"
+additem dhcpcdrundir "accidentally created /@RUNDIR@ does not exist"
 do_dhcpcdrundir()
 {
 	[ -n "$1" ] || err 3 "USAGE: do_dhcpcdrundir fix|check"



CVS commit: src/usr.sbin/postinstall

2021-08-21 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Aug 21 10:06:33 UTC 2021

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
s/accidentaly/accidentally/


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.sbin/postinstall

2020-01-02 Thread Izumi Tsutsui
(Cc'ed to source-changed-d@, not source-changes@)
m...@eterna.com.au wrote:

> "Izumi Tsutsui" writes:
> > Module Name:src
> > Committed By:   tsutsui
> > Date:   Sun Dec 29 22:19:13 UTC 2019
> > 
> > Modified Files:
> > src/usr.sbin/postinstall: postinstall.in
> > 
> > Log Message:
> > Make sure rc, rc.subr, and rc.shutdown are properly updated.
> > 
> > Currently there is no info which rc* files should be updated
> > or not on upgrade (at least rc.conf and rc.local shouldn't),
> > so put back an explicit list in the postinstall script.
> > "Go for it" by christos@ in PR/54741.
> > 
> > Should be pulled up to netbsd-9.
> 
> thanks for making this less bad.
> 
> i wonder if we can have some system in place where we will
> only update these files if we can check they're unmodified,
> eg, each file would have some hash(es) of known versions,
> and if they're found not to match, fail the 'fix' operation
> and allow the user to update manually.  (this will make it
> trip every time, unfortunately, but this seems less bad 
> than overriding local changes - i've been known to change
> rc and rc.subr for various reasons..)

Maybe we should define which files can be configurable or not
in rc(8) man page?

The visible problem is checkyesnox() in rc.subr was added
in netbsd-8 and src/etc/rc.d/network requires checkyesnox().
I.e. rc.d scripts and rc.subr need to be sync'ed on upgrade.

Anyway maybe we need another PR for this.
---
Izumi Tsutsui


CVS commit: src/usr.sbin/postinstall

2019-11-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov 12 23:54:34 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
remove debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2019-11-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov 12 23:54:34 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
remove debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.8 src/usr.sbin/postinstall/postinstall.in:1.9
--- src/usr.sbin/postinstall/postinstall.in:1.8	Wed Oct 30 16:24:44 2019
+++ src/usr.sbin/postinstall/postinstall.in	Tue Nov 12 18:54:34 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.8 2019/10/30 20:24:44 prlw1 Exp $
+# $NetBSD: postinstall.in,v 1.9 2019/11/12 23:54:34 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2253,7 +2253,6 @@ getarchsubdirs() {
 
 getcompatlibdirs() {
 	for i in $(getarchsubdirs); do
-		echo $i 1>&2
 		if [ -d "${DEST_DIR}/usr/lib/$i" ]; then
 			echo /usr/lib/$i
 		fi



CVS commit: src/usr.sbin/postinstall

2019-10-30 Thread Patrick Welche
Module Name:src
Committed By:   prlw1
Date:   Wed Oct 30 20:24:44 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
Add nvmm group.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.7 src/usr.sbin/postinstall/postinstall.in:1.8
--- src/usr.sbin/postinstall/postinstall.in:1.7	Tue Sep 24 13:27:39 2019
+++ src/usr.sbin/postinstall/postinstall.in	Wed Oct 30 20:24:44 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.7 2019/09/24 13:27:39 nakayama Exp $
+# $NetBSD: postinstall.in,v 1.8 2019/10/30 20:24:44 prlw1 Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1138,7 +1138,7 @@ do_gid()
 	"${SRC_DIR}/etc/group" 14 \
 	named ntpd sshd SKIP _pflogd _rwhod staff _proxy _timedc \
 	_sdpd _httpd _mdnsd _tests _tcpdump _tss _gpio _rtadvd SKIP \
-	_unbound _nsd
+	_unbound _nsd nvmm
 }
 
 #



CVS commit: src/usr.sbin/postinstall

2019-10-30 Thread Patrick Welche
Module Name:src
Committed By:   prlw1
Date:   Wed Oct 30 20:24:44 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
Add nvmm group.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2019-09-24 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Tue Sep 24 13:27:39 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
Add ${DEST_DIR} prefix to check target directory not host directory.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2019-09-24 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Tue Sep 24 13:27:39 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
Add ${DEST_DIR} prefix to check target directory not host directory.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.6 src/usr.sbin/postinstall/postinstall.in:1.7
--- src/usr.sbin/postinstall/postinstall.in:1.6	Thu Sep 12 21:56:55 2019
+++ src/usr.sbin/postinstall/postinstall.in	Tue Sep 24 13:27:39 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.6 2019/09/12 21:56:55 uwe Exp $
+# $NetBSD: postinstall.in,v 1.7 2019/09/24 13:27:39 nakayama Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2254,7 +2254,7 @@ getarchsubdirs() {
 getcompatlibdirs() {
 	for i in $(getarchsubdirs); do
 		echo $i 1>&2
-		if [ -d /usr/lib/$i ]; then
+		if [ -d "${DEST_DIR}/usr/lib/$i" ]; then
 			echo /usr/lib/$i
 		fi
 	done



CVS commit: src/usr.sbin/postinstall

2019-09-12 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Sep 12 21:56:55 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
exclude_libs - redirect ls 2> /dev/null so that the user is not
spammed with errors for directories without any libraries; the most
common case in the wild would be empty /usr/libdata/debug.  Add -d to
ls for good measure while here.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.5 src/usr.sbin/postinstall/postinstall.in:1.6
--- src/usr.sbin/postinstall/postinstall.in:1.5	Sat Jun 15 13:07:09 2019
+++ src/usr.sbin/postinstall/postinstall.in	Thu Sep 12 21:56:55 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.5 2019/06/15 13:07:09 christos Exp $
+# $NetBSD: postinstall.in,v 1.6 2019/09/12 21:56:55 uwe Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -591,7 +591,7 @@ exclude()
 # from consideration for removal
 #
 exclude_libs() {
-	local target="$(ls -l lib*.so.* \
+	local target="$(ls -l -d lib*.so.* 2> /dev/null \
 	| ${AWK} '{ print $11; }' \
 	| ${SED} -e 's@.*/@@' | ${SORT} -u)"
 	exclude -t ${target}



CVS commit: src/usr.sbin/postinstall

2019-09-12 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Sep 12 21:56:55 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
exclude_libs - redirect ls 2> /dev/null so that the user is not
spammed with errors for directories without any libraries; the most
common case in the wild would be empty /usr/libdata/debug.  Add -d to
ls for good measure while here.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



re: CVS commit: src/usr.sbin/postinstall

2019-06-15 Thread matthew green
> Modified Files:
>   src/usr.sbin/postinstall: postinstall.in
> 
> Log Message:
> exclude shared libraries that are currently in use from removal.

thank you!  this has bitten me a number of times.


.mrg.


CVS commit: src/usr.sbin/postinstall

2019-06-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 15 13:07:09 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
exclude shared libraries that are currently in use from removal.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.4 src/usr.sbin/postinstall/postinstall.in:1.5
--- src/usr.sbin/postinstall/postinstall.in:1.4	Fri Jun 14 10:39:49 2019
+++ src/usr.sbin/postinstall/postinstall.in	Sat Jun 15 09:07:09 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.4 2019/06/14 14:39:49 christos Exp $
+# $NetBSD: postinstall.in,v 1.5 2019/06/15 13:07:09 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -566,6 +566,37 @@ obsolete_libs()
 	_obsolete_libs "/usr/libdata/debug/${dir}"
 }
 
+exclude()
+{
+	local dollar
+	case "$1" in
+	-t)
+		dollar='$'
+		shift
+		;;
+	*)
+		dollar=
+		;;
+	esac
+	if [ -z "$*" ]; then
+		cat
+	else
+		eval ${GREP} -v -E "'(^$(echo $* | \
+		${SED} -e s/\\././g -e 's/ /'${dollar}'|^/'g)${dollar})'"
+	fi
+}
+
+#
+# find all the target symlinks of shared libaries and exclude them
+# from consideration for removal
+#
+exclude_libs() {
+	local target="$(ls -l lib*.so.* \
+	| ${AWK} '{ print $11; }' \
+	| ${SED} -e 's@.*/@@' | ${SORT} -u)"
+	exclude -t ${target}
+}
+
 _obsolete_libs()
 {
 	dir="$1"
@@ -622,7 +653,7 @@ function checklib(results, line, regex) 
 		checklib(major, $0, "^lib.*\\.so\\.")
 }
 
-#}'
+#}' | exclude_libs
 
 	)
 }
@@ -1437,14 +1468,6 @@ select_obsolete_files()
 	${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" $3
 }
 
-exclude()
-{
-	if [ -z "$*" ]; then
-		cat
-	else
-		eval ${GREP} -v -E "'(^$(echo $* | sed -e 's/ /|^/'g))'"
-	fi
-}
 
 getetcsets()
 {



CVS commit: src/usr.sbin/postinstall

2019-06-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 15 13:07:09 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
exclude shared libraries that are currently in use from removal.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2019-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 14 14:39:49 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
cleanup obsolete file selection from sets and refactor font synchronization.
The font config files are not in sets, so they are still hard-coded.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.3 src/usr.sbin/postinstall/postinstall.in:1.4
--- src/usr.sbin/postinstall/postinstall.in:1.3	Fri Jun 14 10:17:45 2019
+++ src/usr.sbin/postinstall/postinstall.in	Fri Jun 14 10:39:49 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.3 2019/06/14 14:17:45 christos Exp $
+# $NetBSD: postinstall.in,v 1.4 2019/06/14 14:39:49 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1013,38 +1013,42 @@ do_fontconfig()
 		msg "${FONTCONFIG_DIR} is not a directory; skipping check"
 		return 0
 	fi
-
-	populate_dir "$op" false "${FONTCONFIG_DIR}" "${DEST_DIR}/etc/fonts/conf.avail" 444 \
-		10-autohint.conf \
-		10-no-sub-pixel.conf \
-		10-scale-bitmap-fonts.conf \
-		10-sub-pixel-bgr.conf \
-		10-sub-pixel-rgb.conf \
-		10-sub-pixel-vbgr.conf \
-		10-sub-pixel-vrgb.conf \
-		10-unhinted.conf \
-		11-lcdfilter-default.conf \
-		11-lcdfilter-legacy.conf \
-		11-lcdfilter-light.conf \
-		20-unhint-small-vera.conf \
-		25-unhint-nonlatin.conf \
-		30-metric-aliases.conf \
-		40-nonlatin.conf \
-		45-generic.conf \
-		45-latin.conf \
-		49-sansserif.conf \
-		50-user.conf \
-		51-local.conf \
-		60-generic.conf \
-		60-latin.conf \
-		65-fonts-persian.conf \
-		65-khmer.conf \
-		65-nonlatin.conf \
-		69-unifont.conf \
-		70-no-bitmaps.conf \
-		70-yes-bitmaps.conf \
-		80-delicious.conf \
-		90-synthetic.conf
+	local regular_fonts="
+10-autohint.conf
+10-no-sub-pixel.conf
+10-scale-bitmap-fonts.conf
+10-sub-pixel-bgr.conf
+10-sub-pixel-rgb.conf
+10-sub-pixel-vbgr.conf
+10-sub-pixel-vrgb.conf
+10-unhinted.conf
+11-lcdfilter-default.conf
+11-lcdfilter-legacy.conf
+11-lcdfilter-light.conf
+20-unhint-small-vera.conf
+25-unhint-nonlatin.conf
+30-metric-aliases.conf
+40-nonlatin.conf
+45-generic.conf
+45-latin.conf
+49-sansserif.conf
+50-user.conf
+51-local.conf
+60-generic.conf
+60-latin.conf
+65-fonts-persian.conf
+65-khmer.conf
+65-nonlatin.conf
+69-unifont.conf
+70-no-bitmaps.conf
+70-yes-bitmaps.conf
+80-delicious.conf
+90-synthetic.conf
+"
+	populate_dir "$op" false "${FONTCONFIG_DIR}" \
+	"${DEST_DIR}/etc/fonts/conf.avail" \
+	444 \
+	${regular_fonts}
 	failed=$(( ${failed} + $? ))
 
 	if ! $SOURCEMODE; then
@@ -1059,31 +1063,33 @@ do_fontconfig()
 
 	# We can't modify conf.d easily; someone might have removed a file.
 
-	conf_d_failed=0
 	# Look for old files that need to be deleted.
-	if [ -f "${DEST_DIR}/etc/fonts/conf.d/10-unhinted.conf" -a \
-	 -f "${DEST_DIR}/etc/fonts/conf.d/10-autohint.conf" ]; then
-		conf_d_failed=1
-		failed=$(( ${failed} + 1 ))
-	fi
+	obsolete_fonts="
+10-autohint.conf
+10-no-sub-pixel.conf
+10-sub-pixel-bgr.conf
+10-sub-pixel-rgb.conf
+10-sub-pixel-vbgr.conf
+10-sub-pixel-vrgb.conf
+10-unhinted.conf
+25-unhint-nonlatin.conf
+65-khmer.conf
+70-no-bitmaps.conf
+70-yes-bitmaps.conf
+"
+	failed_fonts=""
+	for i in ${obsolete_fonts}; do
+	if [ -f "${DEST_DIR}/etc/fonts/conf.d/$i" ]; then
+		conf_d_failed=1
+		failed_fonts="$failed_fonts $i"
+	fi
+	done
 
-	if [ "$conf_d_failed" = 1 ]; then
-		msg \
-"Broken fontconfig configuration found; please delete these files"
-		msg \
-"in the ${DEST_DIR}/etc/fonts/conf.d/ subdirectory:"
-		msg \
-"   10-autohint.conf 10-no-sub-pixel.conf 10-sub-pixel-bgr.conf"
-		msg \
-"   10-sub-pixel-rgb.conf 10-sub-pixel-vbgr.conf"
+	if [ -n "$failed_fonts" ]; then
 		msg \
-"   10-sub-pixel-vrgb.conf 10-unhinted.conf 25-unhint-nonlatin.conf"
-		msg \
-"   65-khmer.conf 70-no-bitmaps.conf 70-yes-bitmaps.conf"
-		msg \
-"(This warning only appears if both the 10-unhinted.conf and"
-		msg \
-"10-autohint.conf files are present."
+"Broken fontconfig configuration found; please delete these files:"
+		msg "[$failed_fonts]"
+		failed=$(( ${failed} + 1 ))
 	fi
 
 	return ${failed}
@@ -1422,6 +1428,15 @@ select_set_files()
 	-e "/^\.${qdir}/s@^.$2[[:space:]].*@\1@p" $3
 }
 
+# select obsolete files in a sets file
+# $1: directory pattern
+# $2: file pattern
+# $3: filename
+select_obsolete_files()
+{
+	${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" $3
+}
+
 exclude()
 {
 	if [ -z "$*" ]; then
@@ -1465,9 +1480,8 @@ do_rc()
 	exclude ${rc_external_files})"
 
 	# obsolete rc file in /etc/rc.d
-	local rc_obsolete_files="$(${SED} -n \
-	-e '/obsolete/s@./etc/rc.d/\([^[:space:]]*\)[[:space:]].*@\1@p' \

CVS commit: src/usr.sbin/postinstall

2019-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 14 14:39:49 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
cleanup obsolete file selection from sets and refactor font synchronization.
The font config files are not in sets, so they are still hard-coded.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2019-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 14 14:17:45 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
select the powerd scripts from the sets


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.2 src/usr.sbin/postinstall/postinstall.in:1.3
--- src/usr.sbin/postinstall/postinstall.in:1.2	Thu Jun 13 21:54:16 2019
+++ src/usr.sbin/postinstall/postinstall.in	Fri Jun 14 10:17:45 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.2 2019/06/14 01:54:16 christos Exp $
+# $NetBSD: postinstall.in,v 1.3 2019/06/14 14:17:45 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -972,17 +972,21 @@ additem envsys "envsys configuration is 
 do_envsys()
 {
 	[ -n "$1" ] || err 3 "USAGE: do_envsys fix|check"
-	op="$1"
-	failed=0
+	local op="$1"
+	local failed=0
+	local etcsets=$(getetcsets)
 
 	populate_dir "$op" true "${SRC_DIR}/etc" "${DEST_DIR}/etc" 644 \
 		envsys.conf
 	failed=$(( ${failed} + $? ))
 
+	local powerd_scripts="$(select_set_files /etc/powerd/scripts/ \
+	"/etc/powerd/scripts/\([^[:space:]/]*\)" ${etcsets})"
+
 	populate_dir "$op" true "${SRC_DIR}/etc/powerd/scripts" \
-		"${DEST_DIR}/etc/powerd/scripts" 555 sensor_battery \
-		sensor_drive sensor_fan sensor_indicator sensor_power \
-		sensor_resistance sensor_temperature sensor_voltage
+		"${DEST_DIR}/etc/powerd/scripts" \
+		555 \
+		${powerd_scripts}
 	failed=$(( ${failed} + $? ))
 
 	return ${failed}



CVS commit: src/usr.sbin/postinstall

2019-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 14 01:54:16 UTC 2019

Modified Files:
src/usr.sbin/postinstall: Makefile postinstall.in

Log Message:
make the script MI again (same across all archs)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/postinstall/Makefile
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2019-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 14 01:54:16 UTC 2019

Modified Files:
src/usr.sbin/postinstall: Makefile postinstall.in

Log Message:
make the script MI again (same across all archs)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/postinstall/Makefile
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/postinstall/postinstall.in

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/postinstall/Makefile
diff -u src/usr.sbin/postinstall/Makefile:1.2 src/usr.sbin/postinstall/Makefile:1.3
--- src/usr.sbin/postinstall/Makefile:1.2	Thu Jun 13 21:06:33 2019
+++ src/usr.sbin/postinstall/Makefile	Thu Jun 13 21:54:16 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2019/06/14 01:06:33 christos Exp $
+# $NetBSD: Makefile,v 1.3 2019/06/14 01:54:16 christos Exp $
 
 .include 
 
@@ -9,8 +9,8 @@ FILESDIR=	/usr/sbin
 FILESMODE=	${BINMODE}
 FILESBUILD=	yes
 
-ARCHSUBDIRS	!= ${MAKE} -f ${NETBSDSRCDIR}/compat/archdirs.mk \
-	ACTIVE_CC=clang -V ARCHDIR_SUBDIR | ${TOOL_SED} -e 's@[a-z0-9_]*/@@g'
+ARCHSUBDIRS	!= ${TOOL_SED} -n '/ARCHDIR_SUBDIR/s/[[:space:]]//gp' \
+	${NETBSDSRCDIR}/compat/archdirs.mk
 
 .SUFFIXES: .in
 .in:

Index: src/usr.sbin/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.1 src/usr.sbin/postinstall/postinstall.in:1.2
--- src/usr.sbin/postinstall/postinstall.in:1.1	Thu Jun 13 21:06:33 2019
+++ src/usr.sbin/postinstall/postinstall.in	Thu Jun 13 21:54:16 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.1 2019/06/14 01:06:33 christos Exp $
+# $NetBSD: postinstall.in,v 1.2 2019/06/14 01:54:16 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2187,11 +2187,17 @@ do_obsolete_stand()
 	return ${failed}
 }
 
-getarchsubdirs() {
+listarchsubdirs() {
 	if ! $SOURCEMODE; then
 		echo "@ARCHSUBDIRS@"
-		return
+	else
+		${SED} -n -e '/ARCHDIR_SUBDIR/s/[[:space:]]//gp' \
+		${SRC_DIR}/compat/archdirs.mk 
 	fi
+}
+
+
+getarchsubdirs() {
 	local m
 	case ${MACHINE_ARCH} in
 	*arm*|*aarch64*)	m=arm;;
@@ -2199,12 +2205,14 @@ getarchsubdirs() {
 	*)			m=${MACHINE_ARCH};;
 	esac
 
-	${SED} -n -e "/[=[:space:]]${m}/s@.*[=[:space:]]${m}/\(.*\)@\1@p" \
-	${SRC_DIR}/compat/archdirs.mk | ${SORT} -u
+	for i in $(listarchsubdirs); do
+		echo $i
+	done | ${SORT} -u | ${SED} -n -e "/=${m}/s@.*=${m}/\(.*\)@\1@p"
 }
 
 getcompatlibdirs() {
 	for i in $(getarchsubdirs); do
+		echo $i 1>&2
 		if [ -d /usr/lib/$i ]; then
 			echo /usr/lib/$i
 		fi
@@ -2539,6 +2547,11 @@ _Fix_me_
 	esac
 }
 
+if [ -n "$POSTINSTALL_FUNCTION" ]; then
+	eval "$POSTINSTALL_FUNCTION"
+	exit 0
+fi
+
 # defaults
 #
 PROGNAME="${0##*/}"



CVS commit: src/usr.sbin/postinstall

2019-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 14 01:06:33 UTC 2019

Modified Files:
src/usr.sbin/postinstall: Makefile
Added Files:
src/usr.sbin/postinstall: postinstall.in
Removed Files:
src/usr.sbin/postinstall: postinstall

Log Message:
build dynamically the list of compat archsubdirs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/postinstall/Makefile
cvs rdiff -u -r1.232 -r0 src/usr.sbin/postinstall/postinstall
cvs rdiff -u -r0 -r1.1 src/usr.sbin/postinstall/postinstall.in

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/postinstall/Makefile
diff -u src/usr.sbin/postinstall/Makefile:1.1 src/usr.sbin/postinstall/Makefile:1.2
--- src/usr.sbin/postinstall/Makefile:1.1	Sun Apr 17 11:15:49 2005
+++ src/usr.sbin/postinstall/Makefile	Thu Jun 13 21:06:33 2019
@@ -1,9 +1,23 @@
-# $NetBSD: Makefile,v 1.1 2005/04/17 15:15:49 lukem Exp $
+# $NetBSD: Makefile,v 1.2 2019/06/14 01:06:33 christos Exp $
+
+.include 
 
 FILES=		postinstall
 MAN=		postinstall.8
 
 FILESDIR=	/usr/sbin
 FILESMODE=	${BINMODE}
+FILESBUILD=	yes
+
+ARCHSUBDIRS	!= ${MAKE} -f ${NETBSDSRCDIR}/compat/archdirs.mk \
+	ACTIVE_CC=clang -V ARCHDIR_SUBDIR | ${TOOL_SED} -e 's@[a-z0-9_]*/@@g'
+
+.SUFFIXES: .in
+.in:
+	${_MKTARGET_CREATE}
+	@rm -f ${.TARGET}
+	${TOOL_SED} -e "s#@ARCHSUBDIRS@#${ARCHSUBDIRS}#" < ${.ALLSRC} > ${.TARGET}
+
+CLEANFILES+= postinstall
 
 .include 

Added files:

Index: src/usr.sbin/postinstall/postinstall.in
diff -u /dev/null src/usr.sbin/postinstall/postinstall.in:1.1
--- /dev/null	Thu Jun 13 21:06:33 2019
+++ src/usr.sbin/postinstall/postinstall.in	Thu Jun 13 21:06:33 2019
@@ -0,0 +1,2562 @@
+#!/bin/sh
+#
+# $NetBSD: postinstall.in,v 1.1 2019/06/14 01:06:33 christos Exp $
+#
+# Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Luke Mewburn.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# postinstall
+#	Check for or fix configuration changes that occur
+#	over time as NetBSD evolves.
+#
+
+#
+# XXX BE SURE TO USE ${DEST_DIR} PREFIX BEFORE ALL REAL FILE OPERATIONS XXX
+#
+
+#
+# checks to add:
+#	- sysctl(8) renames (net.inet6.ip6.bindv6only -> net.inet6.ip6.v6only)
+#	- de* -> tlp* migration (/etc/ifconfig.de*, $ifconfig_de*, ...) ?
+#	- support quiet/verbose mode ?
+#	- differentiate between failures caused by missing source
+#	  and real failures
+#	- install moduli into usr/share/examples/ssh and use from there?
+#	- differentiate between "needs fix" versus "can't fix" issues
+#
+
+# This script is executed as part of a cross build.  Allow the build
+# environment to override the locations of some tools.
+: ${AWK:=awk}
+: ${DB:=db}
+: ${GREP:=grep}
+: ${HOST_SH:=sh}
+: ${MAKE:=make}
+: ${PWD_MKDB:=/usr/sbin/pwd_mkdb}
+: ${SED:=sed}
+: ${SORT:=sort}
+: ${STAT:=stat}
+
+#
+#	helper functions
+#
+
+err()
+{
+	exitval=$1
+	shift
+	echo 1>&2 "${PROGNAME}: $*"
+	if [ -n "${SCRATCHDIR}" ]; then
+	/bin/rm -rf "${SCRATCHDIR}"
+	fi
+	exit ${exitval}
+}
+
+warn()
+{
+	echo 1>&2 "${PROGNAME}: $*"
+}
+
+msg()
+{
+	echo "	$*"
+}
+
+mkdtemp()
+{
+	# Make sure we don't loop forever if mkdir will always fail.
+	[ -d /tmp ] || err 2 /tmp is not a directory
+	[ -w /tmp ] || err 2 /tmp is not writable
+
+	_base="/tmp/_postinstall.$$"
+	_serial=0
+
+	while true; do
+		_dir="${_base}.${_serial}"
+		mkdir -m 0700 "${_dir}" && break
+		_serial=$((${_serial} + 1))
+	done
+	echo "${_dir}"
+}
+
+# Quote args to make them safe in the shell.
+# Usage: quotedlist="$(shell_quote args...)"
+#
+# After building up a quoted list, 

CVS commit: src/usr.sbin/postinstall

2019-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 14 01:06:33 UTC 2019

Modified Files:
src/usr.sbin/postinstall: Makefile
Added Files:
src/usr.sbin/postinstall: postinstall.in
Removed Files:
src/usr.sbin/postinstall: postinstall

Log Message:
build dynamically the list of compat archsubdirs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/postinstall/Makefile
cvs rdiff -u -r1.232 -r0 src/usr.sbin/postinstall/postinstall
cvs rdiff -u -r0 -r1.1 src/usr.sbin/postinstall/postinstall.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



re: CVS commit: src/usr.sbin/postinstall

2019-06-13 Thread matthew green
"Christos Zoulas" writes:
> Module Name:  src
> Committed By: christos
> Date: Thu Jun 13 21:20:05 UTC 2019
> 
> Modified Files:
>   src/usr.sbin/postinstall: postinstall
> 
> Log Message:
> remove obsolete library files for all the "compat" subdirs not just amd64
> and sparc64.

i think this broke running without a source tree.
eg, "postinstall -s /path/to/etc.tgz".

thanks.


.mrg.


CVS commit: src/usr.sbin/postinstall

2019-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 13 21:20:05 UTC 2019

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

Log Message:
remove obsolete library files for all the "compat" subdirs not just amd64
and sparc64.


To generate a diff of this commit:
cvs rdiff -u -r1.231 -r1.232 src/usr.sbin/postinstall/postinstall

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/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.231 src/usr.sbin/postinstall/postinstall:1.232
--- src/usr.sbin/postinstall/postinstall:1.231	Thu Jun 13 16:53:33 2019
+++ src/usr.sbin/postinstall/postinstall	Thu Jun 13 17:20:05 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.231 2019/06/13 20:53:33 christos Exp $
+# $NetBSD: postinstall,v 1.232 2019/06/13 21:20:05 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2187,6 +2187,29 @@ do_obsolete_stand()
 	return ${failed}
 }
 
+getarchsubdirs() {
+	if ! $SOURCEMODE; then
+		return
+	fi
+	local m
+	case ${MACHINE_ARCH} in
+	*arm*|*aarch64*)	m=arm;;
+	x86_64)			m=amd64;;
+	*)			m=${MACHINE_ARCH};;
+	esac
+
+	${SED} -n -e "/[=[:space:]]${m}/s@.*[=[:space:]]${m}/\(.*\)@\1@p" \
+	${SRC_DIR}/compat/archdirs.mk | ${SORT} -u
+}
+
+getcompatlibdirs() {
+	for i in $(getarchsubdirs); do
+		if [ -d /usr/lib/$i ]; then
+			echo /usr/lib/$i
+		fi
+	done
+}
+
 #
 #	obsolete
 #	(this item is last to allow other items to move obsolete files)
@@ -2207,8 +2230,9 @@ do_obsolete()
 		obsolete_libs /usr/lib/i18n
 		obsolete_libs /usr/X11R6/lib
 		obsolete_libs /usr/X11R7/lib
-		[ "$MACHINE" = "amd64" ] && obsolete_libs /usr/lib/i386
-		[ "$MACHINE" = "sparc64" ] && obsolete_libs /usr/lib/sparc
+		for i in $(getcompatlibdirs); do
+			obsolete_libs $i
+		done
 	) | obsolete_paths "${op}"
 	failed=$(( ${failed} + $? ))
 



CVS commit: src/usr.sbin/postinstall

2019-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 13 21:20:05 UTC 2019

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

Log Message:
remove obsolete library files for all the "compat" subdirs not just amd64
and sparc64.


To generate a diff of this commit:
cvs rdiff -u -r1.231 -r1.232 src/usr.sbin/postinstall/postinstall

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2019-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 13 20:53:33 UTC 2019

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

Log Message:
Anchor the egrep search to avoid npf.conf matching pf.conf, but don't
anchor $ so that blacklistd machines blackist.


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/usr.sbin/postinstall/postinstall

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/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.230 src/usr.sbin/postinstall/postinstall:1.231
--- src/usr.sbin/postinstall/postinstall:1.230	Thu Jun 13 15:30:30 2019
+++ src/usr.sbin/postinstall/postinstall	Thu Jun 13 16:53:33 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.230 2019/06/13 19:30:30 christos Exp $
+# $NetBSD: postinstall,v 1.231 2019/06/13 20:53:33 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1423,7 +1423,7 @@ exclude()
 	if [ -z "$*" ]; then
 		cat
 	else
-		eval ${GREP} -v -E "'($(echo $* | sed -e 's/ /|/'g))'"
+		eval ${GREP} -v -E "'(^$(echo $* | sed -e 's/ /|^/'g))'"
 	fi
 }
 



CVS commit: src/usr.sbin/postinstall

2019-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 13 20:53:33 UTC 2019

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

Log Message:
Anchor the egrep search to avoid npf.conf matching pf.conf, but don't
anchor $ so that blacklistd machines blackist.


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/usr.sbin/postinstall/postinstall

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2019-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 13 19:30:30 UTC 2019

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

Log Message:
1. fix /etc/defaults/*.conf files
a. there are more rc.conf.append arch than only for x86, deal with them too.
b. populate new /etc/defaults/rc.conf files
2. merge sed patterns
3. deal with empty exclude lists


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/usr.sbin/postinstall/postinstall

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2019-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 13 19:30:30 UTC 2019

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

Log Message:
1. fix /etc/defaults/*.conf files
a. there are more rc.conf.append arch than only for x86, deal with them too.
b. populate new /etc/defaults/rc.conf files
2. merge sed patterns
3. deal with empty exclude lists


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/usr.sbin/postinstall/postinstall

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/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.229 src/usr.sbin/postinstall/postinstall:1.230
--- src/usr.sbin/postinstall/postinstall:1.229	Wed Jun 12 20:24:43 2019
+++ src/usr.sbin/postinstall/postinstall	Thu Jun 13 15:30:30 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.229 2019/06/13 00:24:43 christos Exp $
+# $NetBSD: postinstall,v 1.230 2019/06/13 19:30:30 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -847,21 +847,23 @@ additem defaults "/etc/defaults/ being u
 do_defaults()
 {
 	[ -n "$1" ] || err 3 "USAGE: do_defaults  fix|check"
-	op="$1"
-	failed=0
+	local op="$1"
+	local failed=0
+	local etcsets=$(getetcsets)
 
-	# Except for i386 and amd64, rc.conf(5) should be the same as the
-	# one obtained from a source directory
-	extra_scripts="rc.conf"
-	if [ "$MACHINE" = "i386" -o "$MACHINE" = "amd64" ]; then
-		if $SOURCEMODE; then
-			extra_scripts=	# clear
+	local rc_exclude_scripts=""
+	if $SOURCEMODE; then
+		# For most architectures rc.conf(5) should be the same as the
+		# one obtained from a source directory, except for the ones
+		# that have an append file for it.
+		local rc_conf_app="${SRC_DIR}/etc/etc.${MACHINE}/rc.conf.append"
+		if [ -f "${rc_conf_app}" ]; then
+			rc_exclude_scripts="rc.conf"
 
 			# Generate and compare the correct rc.conf(5) file
 			mkdir "${SCRATCHDIR}/defaults"
 
-			cat "${SRC_DIR}/etc/defaults/rc.conf" \
-			"${SRC_DIR}/etc/etc.${MACHINE}/rc.conf.append" \
+			cat "${SRC_DIR}/etc/defaults/rc.conf" "${rc_conf_app}" \
 			> "${SCRATCHDIR}/defaults/rc.conf"
 
 			compare_dir "${op}" "${SCRATCHDIR}/defaults" \
@@ -872,19 +874,24 @@ do_defaults()
 		fi
 	fi
 
-	compare_dir "$op" "${SRC_DIR}/etc/defaults" "${DEST_DIR}/etc/defaults" \
-		444 \
-		daily.conf monthly.conf npf.boot.conf pkgpath.conf \
-		security.conf weekly.conf ${extra_scripts}
-	failed=$(( ${failed} + $? ))
-
 	find_file_in_dirlist pf.boot.conf "pf.boot.conf" \
 	"${SRC_DIR}/usr.sbin/pf/etc/defaults" "${SRC_DIR}/etc/defaults" \
 	|| return 1
-			# ${dir} is set by find_file_in_dirlist()
+	# ${dir} is set by find_file_in_dirlist()
 	compare_dir "$op" "${dir}" "${DEST_DIR}/etc/defaults" 444 pf.boot.conf
 	failed=$(( ${failed} + $? ))
 
+	rc_exclude_scripts="${rc_exclude_scripts} pf.boot.conf"
+
+	local rc_default_conf_files="$(select_set_files /etc/defaults/ \
+	"/etc/defaults/\([^[:space:]]*\.conf\)" ${etcsets} | \
+	exclude ${rc_exclude_scripts})"
+	compare_dir "$op" "${SRC_DIR}/etc/defaults" "${DEST_DIR}/etc/defaults" \
+		444 \
+		${rc_default_conf_files}
+	failed=$(( ${failed} + $? ))
+
+
 	return ${failed}
 }
 
@@ -1400,9 +1407,33 @@ update_rc()
 	return $?
 }
 
+# select non-obsolete files in a sets file
+# $1: directory pattern
+# $2: file pattern
+# $3: filename
+select_set_files()
+{
+	local qdir="$(echo $1 | ${SED} -e s@/@/@g -e s/\\././g)"
+	${SED} -n -e /obsolete/d \
+	-e "/^\.${qdir}/s@^.$2[[:space:]].*@\1@p" $3
+}
+
 exclude()
 {
-	eval ${GREP} -v -E "'($(echo $* | sed -e 's/ /|/'g))'"
+	if [ -z "$*" ]; then
+		cat
+	else
+		eval ${GREP} -v -E "'($(echo $* | sed -e 's/ /|/'g))'"
+	fi
+}
+
+getetcsets()
+{
+	if $SOURCEMODE; then
+		echo "${SRC_DIR}/distrib/sets/lists/etc/mi"
+	else
+		echo "${SRC_DIR}/etc/mtree/set.etc"
+	fi
 }
 
 additem rc "/etc/rc* and /etc/rc.d/ being up to date"
@@ -1412,12 +1443,7 @@ do_rc()
 	local op="$1"
 	local failed=0
 	local generated_scripts=""
-	local etcsets=
-	if $SOURCEMODE; then
-		etcsets="${SRC_DIR}/distrib/sets/lists/etc/mi"
-	else
-		etcsets="${SRC_DIR}/etc/mtree/set.etc"
-	fi
+	local etcsets=$(getetcsets)
 	if [ "${MKX11}" != "no" ]; then
 		generated_scripts="${generated_scripts} xdm xfs"
 	fi
@@ -1426,14 +1452,12 @@ do_rc()
 	local rc_external_files="blacklist nsd unbound"
 
 	# rc* files in /etc/
-	local rc_444_files="$(${SED} -n -e /obsolete/d -e '/^\.\/etc\/rc\.d/d' \
-	-e '/^\.\/etc\/rc/s@./etc/\([^[:space:]]*\)[[:space:]].*@\1@p' \
-	${etcsets})"
+	local rc_444_files="$(select_set_files /etc/rc \
+	"/etc/\(rc[^[:space:]/]*\)" ${etcsets})"
 
 	# no-obsolete rc files in /etc/rc.d
-	local rc_555_files="$(${SED} -n -e /obsolete/d \
-	-e 's@./etc/rc.d/\([^[:space:]]*\)[[:space:]].*@\1@p' \
-	${etcsets} | \
+	local rc_555_files="$(select_set_files /etc/rc.d/ \
+	

CVS commit: src/usr.sbin/postinstall

2019-06-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 13 00:24:43 UTC 2019

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

Log Message:
handle $SOURCEMODE


To generate a diff of this commit:
cvs rdiff -u -r1.228 -r1.229 src/usr.sbin/postinstall/postinstall

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/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.228 src/usr.sbin/postinstall/postinstall:1.229
--- src/usr.sbin/postinstall/postinstall:1.228	Wed Jun 12 17:08:33 2019
+++ src/usr.sbin/postinstall/postinstall	Wed Jun 12 20:24:43 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.228 2019/06/12 21:08:33 christos Exp $
+# $NetBSD: postinstall,v 1.229 2019/06/13 00:24:43 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1412,6 +1412,12 @@ do_rc()
 	local op="$1"
 	local failed=0
 	local generated_scripts=""
+	local etcsets=
+	if $SOURCEMODE; then
+		etcsets="${SRC_DIR}/distrib/sets/lists/etc/mi"
+	else
+		etcsets="${SRC_DIR}/etc/mtree/set.etc"
+	fi
 	if [ "${MKX11}" != "no" ]; then
 		generated_scripts="${generated_scripts} xdm xfs"
 	fi
@@ -1422,18 +1428,18 @@ do_rc()
 	# rc* files in /etc/
 	local rc_444_files="$(${SED} -n -e /obsolete/d -e '/^\.\/etc\/rc\.d/d' \
 	-e '/^\.\/etc\/rc/s@./etc/\([^[:space:]]*\)[[:space:]].*@\1@p' \
-	${SRC_DIR}/distrib/sets/lists/etc/mi)"
+	${etcsets})"
 
 	# no-obsolete rc files in /etc/rc.d
 	local rc_555_files="$(${SED} -n -e /obsolete/d \
 	-e 's@./etc/rc.d/\([^[:space:]]*\)[[:space:]].*@\1@p' \
-	${SRC_DIR}/distrib/sets/lists/etc/mi | \
+	${etcsets} | \
 	exclude ${rc_external_files})"
 
 	# obsolete rc file in /etc/rc.d
 	local rc_obsolete_files="$(${SED} -n \
 	-e '/obsolete/s@./etc/rc.d/\([^[:space:]]*\)[[:space:]].*@\1@p' \
-	${SRC_DIR}/distrib/sets/lists/etc/mi)"
+	${etcsets})"
 
 	compare_dir "${op}" "${SRC_DIR}/etc" "${DEST_DIR}/etc" 644 \
 		${rc_644_files}



CVS commit: src/usr.sbin/postinstall

2019-06-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 13 00:24:43 UTC 2019

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

Log Message:
handle $SOURCEMODE


To generate a diff of this commit:
cvs rdiff -u -r1.228 -r1.229 src/usr.sbin/postinstall/postinstall

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2019-06-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 12 21:08:33 UTC 2019

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

Log Message:
Add missing npf.boot.conf


To generate a diff of this commit:
cvs rdiff -u -r1.227 -r1.228 src/usr.sbin/postinstall/postinstall

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/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.227 src/usr.sbin/postinstall/postinstall:1.228
--- src/usr.sbin/postinstall/postinstall:1.227	Wed Jun 12 13:45:23 2019
+++ src/usr.sbin/postinstall/postinstall	Wed Jun 12 17:08:33 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.227 2019/06/12 17:45:23 christos Exp $
+# $NetBSD: postinstall,v 1.228 2019/06/12 21:08:33 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -874,8 +874,8 @@ do_defaults()
 
 	compare_dir "$op" "${SRC_DIR}/etc/defaults" "${DEST_DIR}/etc/defaults" \
 		444 \
-		daily.conf monthly.conf pkgpath.conf security.conf \
-		weekly.conf ${extra_scripts}
+		daily.conf monthly.conf npf.boot.conf pkgpath.conf \
+		security.conf weekly.conf ${extra_scripts}
 	failed=$(( ${failed} + $? ))
 
 	find_file_in_dirlist pf.boot.conf "pf.boot.conf" \



CVS commit: src/usr.sbin/postinstall

2019-06-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 12 21:08:33 UTC 2019

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

Log Message:
Add missing npf.boot.conf


To generate a diff of this commit:
cvs rdiff -u -r1.227 -r1.228 src/usr.sbin/postinstall/postinstall

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/postinstall

2019-06-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 12 17:45:24 UTC 2019

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

Log Message:
Remove hard-coded lists of rc files and generate them dynamically from the
sets. Fixes issues with automount, npf_boot etc. that were never updated here!


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/usr.sbin/postinstall/postinstall

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/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.226 src/usr.sbin/postinstall/postinstall:1.227
--- src/usr.sbin/postinstall/postinstall:1.226	Sat May 11 15:31:03 2019
+++ src/usr.sbin/postinstall/postinstall	Wed Jun 12 13:45:23 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.226 2019/05/11 19:31:03 maxv Exp $
+# $NetBSD: postinstall,v 1.227 2019/06/12 17:45:23 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1367,157 +1367,6 @@ do_pwd_mkdb()
 #	rc
 #
 
-# XXX Generate these from ../../distrib/sets/lists
-rc_644_files="
-rc
-rc.subr
-rc.shutdown
-"
-rc_555_files="
-DAEMON
-DISKS
-LOGIN
-NETWORKING
-SERVERS
-accounting
-altqd
-amd
-apmd
-bluetooth
-bootconf.sh
-bootparams
-ccd
-cgd
-cleartmp
-cron
-devpubd
-dhcpcd
-dhcpd
-dhcpd6
-dhcrelay
-dmesg
-downinterfaces
-envsys
-fsck
-fsck_root
-ftp_proxy
-ftpd
-gpio
-hostapd
-httpd
-identd
-ifwatchd
-inetd
-ip6addrctl
-ipfilter
-ipfs
-ipmon
-ipnat
-ipsec
-irdaattach
-iscsi_target
-iscsid
-isibootd
-kdc
-ldconfig
-ldpd
-local
-lpd
-lvm
-makemandb
-mdnsd
-mixerctl
-modules
-mopd
-motd
-mountall
-mountcritlocal
-mountcritremote
-mountd
-moused
-mrouted
-named
-ndbootd
-network
-newsyslog
-nfsd
-nfslocking
-npf
-npfd
-ntpd
-ntpdate
-perusertmp
-pf
-pf_boot
-pflogd
-postfix
-powerd
-ppp
-pwcheck
-quota
-racoon
-raidframe
-raidframeparity
-random_seed
-rarpd
-rbootd
-resize_root
-rndctl
-root
-route6d
-routed
-rpcbind
-rtadvd
-rtclocaltime
-rwho
-savecore
-screenblank
-securelevel
-smtoff
-sshd
-staticroute
-swap1
-swap2
-sysctl
-sysdb
-syslogd
-timed
-tpctl
-ttys
-veriexec
-virecover
-wdogctl
-wpa_supplicant
-wscons
-wsmoused
-ypbind
-yppasswdd
-ypserv
-"
-rc_obsolete_files="
-NETWORK
-btattach
-btconfig
-btcontrol
-btdevctl
-bthcid
-btuartd
-daemon
-fsck.sh
-gated
-isdnd
-kerberos
-login
-nfsiod
-poffd
-portmap
-rtsold
-sdpd
-servers
-sunndd
-systemfs
-xntpd
-"
 rc_obsolete_vars="
 amd amd_master
 btcontrol btcontrol_devices
@@ -1551,21 +1400,46 @@ update_rc()
 	return $?
 }
 
+exclude()
+{
+	eval ${GREP} -v -E "'($(echo $* | sed -e 's/ /|/'g))'"
+}
+
 additem rc "/etc/rc* and /etc/rc.d/ being up to date"
 do_rc()
 {
 	[ -n "$1" ] || err 3 "USAGE: do_rc  fix|check"
-	op="$1"
-	failed=0
-	generated_scripts=""
+	local op="$1"
+	local failed=0
+	local generated_scripts=""
 	if [ "${MKX11}" != "no" ]; then
 		generated_scripts="${generated_scripts} xdm xfs"
 	fi
 
+	# Directories of external programs that have rc files (in bsd)
+	local rc_external_files="blacklist nsd unbound"
+
+	# rc* files in /etc/
+	local rc_444_files="$(${SED} -n -e /obsolete/d -e '/^\.\/etc\/rc\.d/d' \
+	-e '/^\.\/etc\/rc/s@./etc/\([^[:space:]]*\)[[:space:]].*@\1@p' \
+	${SRC_DIR}/distrib/sets/lists/etc/mi)"
+
+	# no-obsolete rc files in /etc/rc.d
+	local rc_555_files="$(${SED} -n -e /obsolete/d \
+	-e 's@./etc/rc.d/\([^[:space:]]*\)[[:space:]].*@\1@p' \
+	${SRC_DIR}/distrib/sets/lists/etc/mi | \
+	exclude ${rc_external_files})"
+
+	# obsolete rc file in /etc/rc.d
+	local rc_obsolete_files="$(${SED} -n \
+	-e '/obsolete/s@./etc/rc.d/\([^[:space:]]*\)[[:space:]].*@\1@p' \
+	${SRC_DIR}/distrib/sets/lists/etc/mi)"
+
 	compare_dir "${op}" "${SRC_DIR}/etc" "${DEST_DIR}/etc" 644 \
 		${rc_644_files}
 	failed=$(( ${failed} + $? ))
 
+	local extra_scripts
 	if ! $SOURCEMODE; then
 		extra_scripts="${generated_scripts}"
 	else
@@ -1577,17 +1451,17 @@ do_rc()
 		${extra_scripts}
 	failed=$(( ${failed} + $? ))
 
-	update_rc "${op}" "${dir}" blacklistd /sbin \
-	"${SRC_DIR}/external/bsd/blacklist/etc/rc.d"
-	failed=$(( ${failed} + $? ))
-
-	update_rc "${op}" "${dir}" unbound /usr/sbin \
-	"${SRC_DIR}/external/bsd/unbound/etc/rc.d"
-	failed=$(( ${failed} + $? ))
-
-	update_rc "${op}" "${dir}" nsd /usr/sbin \
-	"${SRC_DIR}/external/bsd/nsd/etc/rc.d"
-	failed=$(( ${failed} + $? ))
+	for i in ${rc_external_files}; do
+	local rc_file 
+	case $i in
+	*d) rc_file=${i};;
+	*)	rc_file=${i}d;;
+	esac
+		
+	update_rc "${op}" "${dir}" ${rc_file} /sbin \
+		"${SRC_DIR}/external/bsd/$i/etc/rc.d"
+	failed=$(( ${failed} + $? ))
+	done
 
 	if $SOURCEMODE && [ -n "${generated_scripts}" ]; then
 		# generate scripts
@@ -1605,7 +1479,7 @@ do_rc()
 
 		# check for obsolete rc.d files
 	for f in ${rc_obsolete_files}; do
-		fd="/etc/rc.d/${f}"
+		local fd="/etc/rc.d/${f}"
 		[ -e "${DEST_DIR}${fd}" ] && echo "${fd}"
 

CVS commit: src/usr.sbin/postinstall

2019-06-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 12 17:45:24 UTC 2019

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

Log Message:
Remove hard-coded lists of rc files and generate them dynamically from the
sets. Fixes issues with automount, npf_boot etc. that were never updated here!


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/usr.sbin/postinstall/postinstall

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.sbin/postinstall

2015-07-02 Thread Christos Zoulas
In article a98d1c4b-ac15-4532-a0cb-ddffd193d...@3am-software.com,
Matt Thomas  m...@3am-software.com wrote:

 On Jul 1, 2015, at 5:52 AM, Martin Husemann mar...@duskware.de wrote:
 
 On Wed, Jul 01, 2015 at 10:49:51PM +1000, matthew green wrote:
 wait, we do what?  this won't work for r/o src, right?
 
 I guess not (though in most cases you probably will use the sets mode
 of postinstall, which is unaffected).
 
 As I said, we should come up with something better (in
 src/etc/mtree/Makefile), this is just damage limitation and should go
 away after a real fix.

Doesn’t etc/mtree get an obj dir?

Congratulations for upgrading your mac. Now can you disable Smart Quotes?

christos


Re: CVS commit: src/usr.sbin/postinstall

2015-07-02 Thread Martin Husemann
On Wed, Jul 01, 2015 at 09:45:41AM -0700, Matt Thomas wrote:
 Doesn?t etc/mtree get an obj dir?

Not always when invoked from postinstall - but I'll change postinstall to
force a scratch objdir for this.

Martin


re: CVS commit: src/usr.sbin/postinstall

2015-07-01 Thread matthew green

Martin Husemann writes:
 Module Name:  src
 Committed By: martin
 Date: Wed Jul  1 12:40:07 UTC 2015
 
 Modified Files:
   src/usr.sbin/postinstall: postinstall
 
 Log Message:
 Clean up the src/etc/mtree directory after using it to generate the mtree
 spec file.
 XXX this is fishy, we should find a better way.

wait, we do what?  this won't work for r/o src, right?


.mrg.


Re: CVS commit: src/usr.sbin/postinstall

2015-07-01 Thread Martin Husemann
On Wed, Jul 01, 2015 at 10:49:51PM +1000, matthew green wrote:
 wait, we do what?  this won't work for r/o src, right?

I guess not (though in most cases you probably will use the sets mode
of postinstall, which is unaffected).

As I said, we should come up with something better (in
src/etc/mtree/Makefile), this is just damage limitation and should go
away after a real fix.

Martin


Re: CVS commit: src/usr.sbin/postinstall

2015-07-01 Thread Matt Thomas

 On Jul 1, 2015, at 5:52 AM, Martin Husemann mar...@duskware.de wrote:
 
 On Wed, Jul 01, 2015 at 10:49:51PM +1000, matthew green wrote:
 wait, we do what?  this won't work for r/o src, right?
 
 I guess not (though in most cases you probably will use the sets mode
 of postinstall, which is unaffected).
 
 As I said, we should come up with something better (in
 src/etc/mtree/Makefile), this is just damage limitation and should go
 away after a real fix.

It does seems to get an objdir:

$ ls ../amd64/obj/etc/mtree/NetBSD.dist
NetBSD.dist  NetBSD.dist.tmp  
NetBSD.dist.compat   NetBSD.dist.xcompat  

So what is the issue?


Re: CVS commit: src/usr.sbin/postinstall

2015-07-01 Thread Matt Thomas

 On Jul 1, 2015, at 5:52 AM, Martin Husemann mar...@duskware.de wrote:
 
 On Wed, Jul 01, 2015 at 10:49:51PM +1000, matthew green wrote:
 wait, we do what?  this won't work for r/o src, right?
 
 I guess not (though in most cases you probably will use the sets mode
 of postinstall, which is unaffected).
 
 As I said, we should come up with something better (in
 src/etc/mtree/Makefile), this is just damage limitation and should go
 away after a real fix.

Doesn’t etc/mtree get an obj dir?


Re: CVS commit: src/usr.sbin/postinstall

2012-09-22 Thread Jeff Rizzo

On 9/22/12 2:20 AM, Adrian Steinmann wrote:

Module Name:src
Committed By:   ast
Date:   Sat Sep 22 09:20:07 UTC 2012

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

Log Message:
Make sure that the to fix, run: ... instructions actually work cut-and-paste
By default postinstall has mode 644 so /bin/sh or similar needs to be prepended


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/usr.sbin/postinstall/postinstall

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Um, /usr/sbin/postinstall is 555 by default.  :)  I don't know that we 
need to cater to uninstalled versions in the instructions.


+j


Re: CVS commit: src/usr.sbin/postinstall

2012-09-22 Thread Adrian Steinmann
On Sat, Sep 22, 2012 at 12:33:03PM -0700, Jeff Rizzo wrote:
 On 9/22/12 2:20 AM, Adrian Steinmann wrote:
  Module Name:src
  Committed By:   ast
  Date:   Sat Sep 22 09:20:07 UTC 2012
 
  Modified Files:
  src/usr.sbin/postinstall: postinstall
 
  Log Message:
  Make sure that the to fix, run: ... instructions actually work 
  cut-and-paste
  By default postinstall has mode 644 so /bin/sh or similar needs to be 
  prepended
 
 
 Um, /usr/sbin/postinstall is 555 by default.  :)  I don't know that we 
 need to cater to uninstalled versions in the instructions.

Yes, it is installed with mode 555 in /usr/sbin/postinstall *but*
if one uses the src tarballs and then runs build.ch install=/ it
uses the /usr/src/...  postinstall (which is 755 from the CVS repo,
but 644 from the src.tgz) The maybe not-so-rare edge case when one
build from src.tgz instead of CVS thus issues faulty instructions.

That /usr/src/.../postinstall is used can be seen in /usr/src/Makefile:

_POSTINSTALL=   ${.CURDIR}/usr.sbin/postinstall/postinstall
_POSTINSTALL_ENV= \
AWK=${TOOL_AWK:Q}   \
DB=${TOOL_DB:Q} \
HOST_SH=${HOST_SH:Q}\
MAKE=${MAKE:Q}  \
PWD_MKDB=${TOOL_PWD_MKDB:Q} \
STAT=${TOOL_STAT:Q} 

postinstall-check: .PHONY
@echo=== Post installation checks ===
${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDI
R}/ check; if [ $$? -gt 1 ]; then exit 1; fi
@echo

postinstall-fix: .NOTMAIN .PHONY 
@echo=== Post installation fixes ===
${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDI
R}/ fix
@echo===


BTW, this is the diff, it is a here-is message:

RCS file: /cvsroot/src/usr.sbin/postinstall/postinstall,v
 ${0} ${SRC_ARGLIST} -d ${DEST_DIR:-/}$m fix${items_failed}
---
 ${HOST_SH} ${0} ${SRC_ARGLIST} -d ${DEST_DIR:-/}$m fix${items_failed}

Ast