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