Module Name:    src
Committed By:   christos
Date:           Wed Dec  4 04:45:42 UTC 2019

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.9 src/usr.sbin/postinstall/postinstall.in:1.10
--- src/usr.sbin/postinstall/postinstall.in:1.9	Tue Nov 12 18:54:34 2019
+++ src/usr.sbin/postinstall/postinstall.in	Tue Dec  3 23:45:42 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.9 2019/11/12 23:54:34 christos Exp $
+# $NetBSD: postinstall.in,v 1.10 2019/12/04 04:45:42 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1462,13 +1462,17 @@ 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
+	else
+		${SED} -n -e "s@\.$1$2\$@\1@p" "${DEST_DIR}/var/db/obsolete/$3"
+	fi
 }
 
-
 getetcsets()
 {
 	if $SOURCEMODE; then
@@ -1504,7 +1508,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}

Reply via email to