This commit is contained in:
Joel Busch 2023-12-07 14:05:54 +11:00 committed by GitHub
commit 0ebcd692ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 25 deletions

View File

@ -330,10 +330,8 @@ fi
minsize=$(cut -d ':' -f 2 <<< "$minsize" | tr -d ' ') minsize=$(cut -d ':' -f 2 <<< "$minsize" | tr -d ' ')
logVariables $LINENO currentsize minsize logVariables $LINENO currentsize minsize
if [[ $currentsize -eq $minsize ]]; then if [[ $currentsize -eq $minsize ]]; then
error $LINENO "Image already shrunk to smallest size" info "Filesystem already shrunk to smallest size. Skipping filesystem shrinking."
exit 11 else
fi
#Add some free space to the end of the filesystem #Add some free space to the end of the filesystem
extra_space=$(($currentsize - $minsize)) extra_space=$(($currentsize - $minsize))
logVariables $LINENO extra_space logVariables $LINENO extra_space
@ -358,8 +356,10 @@ if (( $rc )); then
exit 12 exit 12
fi fi
sleep 1 sleep 1
fi
#Shrink partition #Shrink partition
info "Shrinking partition"
partnewsize=$(($minsize * $blocksize)) partnewsize=$(($minsize * $blocksize))
newpartend=$(($partstart + $partnewsize)) newpartend=$(($partstart + $partnewsize))
logVariables $LINENO partnewsize newpartend logVariables $LINENO partnewsize newpartend