Module Name:    src
Committed By:   christos
Date:           Sun Dec 22 18:41:37 UTC 2019

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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.10 src/usr.sbin/postinstall/postinstall.in:1.11
--- src/usr.sbin/postinstall/postinstall.in:1.10	Tue Dec  3 23:45:42 2019
+++ src/usr.sbin/postinstall/postinstall.in	Sun Dec 22 13:41:36 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.10 2019/12/04 04:45:42 christos Exp $
+# $NetBSD: postinstall.in,v 1.11 2019/12/22 18:41:36 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1468,9 +1468,21 @@ select_obsolete_files()
 	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
-		${SED} -n -e "s@\.$1$2\$@\1@p" "${DEST_DIR}/var/db/obsolete/$3"
+		obsolete_dir=${DEST_DIR}/var/db/obsolete
 	fi
+	${SED} -n -e "s@\.$1$2\$@\1@p" "${obsolete_dir}/$3"
 }
 
 getetcsets()

Reply via email to