summaryrefslogtreecommitdiff
path: root/usr.sbin/syspatch
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2017-07-22 09:59:09 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2017-07-22 09:59:09 +0000
commitefb5dd01c494d8a76d58d375a56e22640e9814b8 (patch)
treeff4049842171435d2a665614bf6b8359248df326 /usr.sbin/syspatch
parentbd2709dd1500f77d1f9d41d0c8cdd51781768680 (diff)
Cleanup previous release patches and backup kernel _before_ applying new
patches. This will mitigate possible /var overflow (previous behavior was to clean up _after_ applying all patches which means we would have rollback patches from the previous and current release before the previous ones got cleaned).
Diffstat (limited to 'usr.sbin/syspatch')
-rw-r--r--usr.sbin/syspatch/syspatch.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/syspatch/syspatch.sh b/usr.sbin/syspatch/syspatch.sh
index fcc9790c4f2..9ecc19f2e23 100644
--- a/usr.sbin/syspatch/syspatch.sh
+++ b/usr.sbin/syspatch/syspatch.sh
@@ -1,6 +1,6 @@
#!/bin/ksh
#
-# $OpenBSD: syspatch.sh,v 1.115 2017/07/04 20:25:53 ajacoutot Exp $
+# $OpenBSD: syspatch.sh,v 1.116 2017/07/22 09:59:08 ajacoutot Exp $
#
# Copyright (c) 2016, 2017 Antoine Jacoutot <ajacoutot@openbsd.org>
#
@@ -262,11 +262,6 @@ sp_cleanup()
[[ -f ${_k} ]] || continue
[[ ${_k} == /bsd.syspatch${_OSrev} ]] || rm ${_k}
done
-
- # in case a patch added a new directory (install -D)
- mtree -qdef /etc/mtree/4.4BSD.dist -p / -U >/dev/null
- [[ -f /var/sysmerge/xetc.tgz ]] &&
- mtree -qdef /etc/mtree/BSD.x11.dist -p / -U >/dev/null
}
unpriv()
@@ -322,10 +317,15 @@ done
shift $((OPTIND - 1))
(($# != 0)) && usage
+# default action: apply all patches
if ((OPTIND == 1)); then
+ sp_cleanup
_PATCHES=$(ls_missing)
for _PATCH in ${_PATCHES}; do
apply_patch ${_OSrev}-${_PATCH}
done
- sp_cleanup
+ # in case a patch added a new directory (install -D)
+ mtree -qdef /etc/mtree/4.4BSD.dist -p / -U >/dev/null
+ [[ ! -f /var/sysmerge/xetc.tgz ]] ||
+ mtree -qdef /etc/mtree/BSD.x11.dist -p / -U >/dev/null
fi