From 4409e1965d65b3cb0061cb098f32c9ba9aaff18b Mon Sep 17 00:00:00 2001 From: kn Date: Sat, 17 Jan 2026 21:20:44 +0000 Subject: [PATCH] Check absoloute free space rather than usage percentage 10% on big (single filesystem) disks can still be plenty enough; on the flip side, e.g. 10% of 3G /usr is often still too tight. So instead of ">= 90% used", use "< 1G free" to bail out early. Input OK sthen --- usr.sbin/sysupgrade/sysupgrade.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/usr.sbin/sysupgrade/sysupgrade.sh b/usr.sbin/sysupgrade/sysupgrade.sh index e56866bad14..de1b2703b88 100644 --- a/usr.sbin/sysupgrade/sysupgrade.sh +++ b/usr.sbin/sysupgrade/sysupgrade.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: sysupgrade.sh,v 1.60 2025/11/12 11:22:48 deraadt Exp $ +# $OpenBSD: sysupgrade.sh,v 1.61 2026/01/17 21:20:44 kn Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015 Robert Peichaer @@ -118,9 +118,8 @@ $FORCE_VERSION && $SNAP && $FORCE && ! $SNAP && err "incompatible options: -f without -s" -USED_USR=$(df -P /usr | awk 'NR==2 {print substr($5, 1, length($5)-1)}') -if (( ${USED_USR} >= 90 )) && ! $FORCE; then - err "/usr appears too small. See sysupgrade(8) manpage about PRUNING." +if df -kP /usr | ! awk 'NR == 2 && $4 < 1*1024^2 { exit(1) }' && ! $FORCE; then + err "/usr appears too small. See sysupgrade(8) manpage about PRUNING." fi if $SNAP; then