Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/postinstall remove obsolete library files for all t...



details:   https://anonhg.NetBSD.org/src/rev/948bff42cb58
branches:  trunk
changeset: 842052:948bff42cb58
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jun 13 21:20:05 2019 +0000

description:
remove obsolete library files for all the "compat" subdirs not just amd64
and sparc64.

diffstat:

 usr.sbin/postinstall/postinstall |  30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diffs (53 lines):

diff -r d8ad2da991c2 -r 948bff42cb58 usr.sbin/postinstall/postinstall
--- a/usr.sbin/postinstall/postinstall  Thu Jun 13 21:17:54 2019 +0000
+++ b/usr.sbin/postinstall/postinstall  Thu Jun 13 21:20:05 2019 +0000
@@ -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 @@
        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 @@
                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} + $? ))
 



Home | Main Index | Thread Index | Old Index