From 524131ea7f19b53b79ee52c1c4d1e2f9ce55230f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=B5=E4=BA=8C?= <66155308+miaoermua@users.noreply.github.com> Date: Mon, 29 Jul 2024 00:14:43 +0800 Subject: [PATCH] Update cattools.sh --- cattools.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cattools.sh b/cattools.sh index be57151..ffd7aae 100644 --- a/cattools.sh +++ b/cattools.sh @@ -901,8 +901,12 @@ sysupgrade() { echo "" - disk_size=$(fdisk -l /dev/sda | grep "Disk /dev/sda:" | awk '{print $3}') - if (($(echo "$disk_size != 800.28" | bc -l))); then + tolerance=$(echo "200/1024/1024" | bc -l) + allowed_size=800.28 + min_size=$(echo "$allowed_size - $tolerance" | bc -l) + max_size=$(echo "$allowed_size + $tolerance" | bc -l) + + if (($(echo "$disk_size < $min_size" | bc -l))) || (($(echo "$disk_size > $max_size" | bc -l))); then echo "[Error] 磁盘空间出现过修改或不匹配,无法继续升级。" exit 1 fi