Add check for size in CreatePersistentImg.sh (#1384)

This commit is contained in:
longpanda 2022-01-15 09:13:46 +08:00
parent 2ad69decad
commit 28998edd94
1 changed files with 8 additions and 3 deletions

View File

@ -56,10 +56,15 @@ fi
# check size
if echo $size | grep -q "^[0-9][0-9]*$"; then
if [ $size -le 1 ]; then
echo "Invalid size $size"
exit 1
vtMinSize=1
if echo $fstype | grep -q '^xfs$'; then
vtMinSize=16
fi
if [ $size -lt $vtMinSize ]; then
echo "size too small ($size)"
exit 1
fi
else
echo "Invalid size $size"
exit 1