Skip filesystem shrinking without error if small
This commit is contained in:
parent
43f1a885cd
commit
2d97ee2195
|
@ -332,10 +332,8 @@ fi
|
|||
minsize=$(cut -d ':' -f 2 <<< "$minsize" | tr -d ' ')
|
||||
logVariables $LINENO currentsize minsize
|
||||
if [[ $currentsize -eq $minsize ]]; then
|
||||
error $LINENO "Image already shrunk to smallest size"
|
||||
exit 11
|
||||
fi
|
||||
|
||||
info "Filesystem already shrunk to smallest size. Skipping filesystem shrinking."
|
||||
else
|
||||
#Add some free space to the end of the filesystem
|
||||
extra_space=$(($currentsize - $minsize))
|
||||
logVariables $LINENO extra_space
|
||||
|
@ -360,8 +358,10 @@ if (( $rc )); then
|
|||
exit 12
|
||||
fi
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
#Shrink partition
|
||||
info "Shrinking partition"
|
||||
partnewsize=$(($minsize * $blocksize))
|
||||
newpartend=$(($partstart + $partnewsize))
|
||||
logVariables $LINENO partnewsize newpartend
|
||||
|
|
Loading…
Reference in New Issue