Module Name:    src
Committed By:   martin
Date:           Thu Jan  2 09:09:01 UTC 2020

Modified Files:
        src/usr.sbin/postinstall [netbsd-9]: postinstall.in

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #592):

        usr.sbin/postinstall/postinstall.in: revision 1.9
        usr.sbin/postinstall/postinstall.in: revision 1.10
        usr.sbin/postinstall/postinstall.in: revision 1.11
        usr.sbin/postinstall/postinstall.in: revision 1.12

remove debugging.

PR/54730: Izumi Tsutsui: Use /var/db/obsolete/<set> to remove obsolete rc.d
files when not in $SOURCEMODE.

PR/54730: Izumi Tsutsui: obsolete etc files are not being cleaned up on
an upgrade build.

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.


To generate a diff of this commit:
cvs rdiff -u -r1.5.2.2 -r1.5.2.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.5.2.2 src/usr.sbin/postinstall/postinstall.in:1.5.2.3
--- src/usr.sbin/postinstall/postinstall.in:1.5.2.2	Sun Nov 10 12:58:30 2019
+++ src/usr.sbin/postinstall/postinstall.in	Thu Jan  2 09:09:01 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.5.2.2 2019/11/10 12:58:30 martin Exp $
+# $NetBSD: postinstall.in,v 1.5.2.3 2020/01/02 09:09:01 martin Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1415,6 +1415,14 @@ do_pwd_mkdb()
 #	rc
 #
 
+# There is no info in src/distrib or /etc/mtree which rc* files
+# can be overwritten unconditionally on upgrade. See PR/54741.
+rc_644_files="
+rc
+rc.subr
+rc.shutdown
+"
+
 rc_obsolete_vars="
 amd amd_master
 btcontrol btcontrol_devices
@@ -1462,12 +1470,28 @@ select_set_files()
 # select obsolete files in a sets file
 # $1: directory pattern
 # $2: file pattern
-# $3: filename
+# $3: setname
 select_obsolete_files()
 {
-	${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" $3
-}
+	if $SOURCEMODE; then
+		${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" \
+		    ${SRC_DIR}/distrib/sets/lists/$3/mi
+		return
+	fi
+
+	# On upgrade builds we don't extract the "etc" set so we
+	# try to use the source set instead. See PR/54730 for
+	# ways to better handle this.
+
+	local obsolete_dir
 
+	if [ $3 = "etc" ] ;then
+		obsolete_dir=${SRC_DIR}/var/db/obsolete
+	else
+		obsolete_dir=${DEST_DIR}/var/db/obsolete
+	fi
+	${SED} -n -e "s@\.$1$2\$@\1@p" "${obsolete_dir}/$3"
+}
 
 getetcsets()
 {
@@ -1494,8 +1518,9 @@ do_rc()
 	local rc_external_files="blacklist nsd unbound"
 
 	# rc* files in /etc/
-	local rc_444_files="$(select_set_files /etc/rc \
-	    "/etc/\(rc[^[:space:]/]*\)" ${etcsets})"
+	# XXX: at least rc.conf and rc.local shouldn't be updated. PR/54741
+	#local rc_644_files="$(select_set_files /etc/rc \
+	#    "/etc/\(rc[^[:space:]/]*\)" ${etcsets})"
 
 	# no-obsolete rc files in /etc/rc.d
 	local rc_555_files="$(select_set_files /etc/rc.d/ \
@@ -1504,7 +1529,7 @@ do_rc()
 
 	# obsolete rc file in /etc/rc.d
 	local rc_obsolete_files="$(select_obsolete_files /etc/rc.d/ \
-	    "\([^[:space:]]*\)" ${etcsets})"
+	    "\([^[:space:]]*\)" etc)"
 
 	compare_dir "${op}" "${SRC_DIR}/etc" "${DEST_DIR}/etc" 644 \
 		${rc_644_files}
@@ -2253,7 +2278,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

Reply via email to