diff options
author | 2019-08-14 19:32:41 +0000 | |
---|---|---|
committer | 2019-08-14 19:32:41 +0000 | |
commit | dfb9d72152ce05f3b5864164e5d6bb6dbc4303cd (patch) | |
tree | 9a866421c4033f87e1fb66cffa5a5bfecab5e87c | |
parent | Fix argument list for ber_set_writecallback (diff) | |
download | wireguard-openbsd-dfb9d72152ce05f3b5864164e5d6bb6dbc4303cd.tar.xz wireguard-openbsd-dfb9d72152ce05f3b5864164e5d6bb6dbc4303cd.zip |
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@
-rw-r--r-- | distrib/miniroot/install.sub | 17 |
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() { |