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} + $? ))
 

Reply via email to