From add5ce28c024816b20f336f4b75ef551663dfcbe Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 13 Jun 2019 21:20:05 +0000 Subject: [PATCH] remove obsolete library files for all the "compat" subdirs not just amd64 and sparc64. --- usr.sbin/postinstall/postinstall | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/usr.sbin/postinstall/postinstall b/usr.sbin/postinstall/postinstall index 56c5247d491b..ff67a4870b80 100755 --- a/usr.sbin/postinstall/postinstall +++ b/usr.sbin/postinstall/postinstall @@ -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} + $? ))