Add the -s flag to all parted commands

This commit is contained in:
Andrew Scheller 2018-01-22 01:45:17 +00:00
parent b787dd4e66
commit 0b19d6c6ea
1 changed files with 5 additions and 5 deletions

View File

@ -48,8 +48,8 @@ fi
#Gather info
beforesize=$(ls -lah "$img" | cut -d ' ' -f 5)
partnum=$(parted -m "$img" unit B print | tail -n 1 | cut -d ':' -f 1 | tr -d '\n')
partstart=$(parted -m "$img" unit B print | tail -n 1 | cut -d ':' -f 2 | tr -d 'B\n')
partnum=$(parted -ms "$img" unit B print | tail -n 1 | cut -d ':' -f 1 | tr -d '\n')
partstart=$(parted -ms "$img" unit B print | tail -n 1 | cut -d ':' -f 2 | tr -d 'B\n')
loopback=$(losetup -f --show -o $partstart "$img")
currentsize=$(tune2fs -l $loopback | grep 'Block count' | tr -d ' ' | cut -d ':' -f 2 | tr -d '\n')
blocksize=$(tune2fs -l $loopback | grep 'Block size' | tr -d ' ' | cut -d ':' -f 2 | tr -d '\n')
@ -163,11 +163,11 @@ sleep 1
losetup -d $loopback
partnewsize=$(expr $minsize \* $blocksize | tr -d '\n')
newpartend=$(expr $partstart + $partnewsize | tr -d '\n')
parted "$img" rm $partnum >/dev/null
parted "$img" unit B mkpart primary $partstart $newpartend >/dev/null
parted -s "$img" rm $partnum >/dev/null
parted -s "$img" unit B mkpart primary $partstart $newpartend >/dev/null
#Truncate the file
endresult=$(parted -m "$img" unit B print free | tail -1 | cut -d ':' -f 2 | tr -d 'B\n')
endresult=$(parted -ms "$img" unit B print free | tail -1 | cut -d ':' -f 2 | tr -d 'B\n')
truncate -s $endresult "$img"
aftersize=$(ls -lah "$img" | cut -d ' ' -f 5)