summaryrefslogtreecommitdiff
path: root/distrib
diff options
context:
space:
mode:
authorChristian Weisgerber <naddy@cvs.openbsd.org>2019-08-14 19:32:42 +0000
committerChristian Weisgerber <naddy@cvs.openbsd.org>2019-08-14 19:32:42 +0000
commita7bae46ae2f2d73234e7056e9c3993c76e619fb8 (patch)
tree578c3b545306d136538011da389b5012827eb6ae /distrib
parent9c5dab792fd3a1d1f49d55596f67c018f2a13f1d (diff)
Clean up clean_old():
* Remove syspatch files from the installed system and not the ramdisk. * Directly try to remove the old files without superfluous check. * Use an extended glob to match /usr/lib/gcc-lib contents that don't belong to this OS version. * For /usr/lib/clang, set an array to the expansion of the glob, which is an alphabetically sorted list, drop the last element, and rm the rest. ok tb@
Diffstat (limited to 'distrib')
-rw-r--r--distrib/miniroot/install.sub17
1 files changed, 8 insertions, 9 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index a2add06a7ee..3914a496046 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1138 2019/08/13 07:47:40 kn Exp $
+# $OpenBSD: install.sub,v 1.1139 2019/08/14 19:32:41 naddy Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -2860,14 +2860,13 @@ __EOT
}
clean_old() {
- if [[ -f /mnt/usr/bin/gcc ]]; then
- rm -rf -- `ls -d /mnt/usr/lib/gcc-lib/* | grep -v ${VNAME}$`
- fi
- if [[ -f /mnt/usr/bin/clang ]]; then
- CVER=$(cd /mnt/usr/lib/clang && ls -r | sed -e 1q)
- rm -rf -- `ls -d /mnt/usr/lib/clang/* | grep -v "${CVER}$"`
- fi
- rm -rf /var/syspatch/*
+ local _cver
+
+ rm -rf /mnt/usr/lib/gcc-lib/!(*$VNAME)
+ set -A _cver -- /mnt/usr/lib/clang/* &&
+ unset _cver[${#_cver[@]}-1] &&
+ rm -rf "${_cver[@]}"
+ rm -rf /mnt/var/syspatch/*
}
do_autoinstall() {