Module Name: src Committed By: christos Date: Sat Jun 15 13:07:09 UTC 2019
Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: exclude shared libraries that are currently in use from removal. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 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.4 src/usr.sbin/postinstall/postinstall.in:1.5 --- src/usr.sbin/postinstall/postinstall.in:1.4 Fri Jun 14 10:39:49 2019 +++ src/usr.sbin/postinstall/postinstall.in Sat Jun 15 09:07:09 2019 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.4 2019/06/14 14:39:49 christos Exp $ +# $NetBSD: postinstall.in,v 1.5 2019/06/15 13:07:09 christos Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -566,6 +566,37 @@ obsolete_libs() _obsolete_libs "/usr/libdata/debug/${dir}" } +exclude() +{ + local dollar + case "$1" in + -t) + dollar='$' + shift + ;; + *) + dollar= + ;; + esac + if [ -z "$*" ]; then + cat + else + eval ${GREP} -v -E "'(^$(echo $* | \ + ${SED} -e s/\\./\\\\./g -e 's/ /'${dollar}'|^/'g)${dollar})'" + fi +} + +# +# find all the target symlinks of shared libaries and exclude them +# from consideration for removal +# +exclude_libs() { + local target="$(ls -l lib*.so.* \ + | ${AWK} '{ print $11; }' \ + | ${SED} -e 's@.*/@@' | ${SORT} -u)" + exclude -t ${target} +} + _obsolete_libs() { dir="$1" @@ -622,7 +653,7 @@ function checklib(results, line, regex) checklib(major, $0, "^lib.*\\.so\\.") } -#}' +#}' | exclude_libs ) } @@ -1437,14 +1468,6 @@ select_obsolete_files() ${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" $3 } -exclude() -{ - if [ -z "$*" ]; then - cat - else - eval ${GREP} -v -E "'(^$(echo $* | sed -e 's/ /|^/'g))'" - fi -} getetcsets() {