Fixed pishrink issue #133
This commit is contained in:
parent
24c6f57efd
commit
9a2c7fe949
|
@ -178,14 +178,14 @@ trap cleanup ERR EXIT
|
||||||
#Gather info
|
#Gather info
|
||||||
info "Gathering data"
|
info "Gathering data"
|
||||||
beforesize="$(ls -lh "$img" | cut -d ' ' -f 5)"
|
beforesize="$(ls -lh "$img" | cut -d ' ' -f 5)"
|
||||||
if ! parted_output=$(parted -ms "$img" unit B print); then
|
if ! parted_output="$(parted -ms "$img" unit B print)"; then
|
||||||
rc=$?
|
rc=$?
|
||||||
error $LINENO "parted failed with rc $rc"
|
error $LINENO "parted failed with rc $rc"
|
||||||
info "Possibly invalid image. Run 'parted $img unit B print' manually to investigate"
|
info "Possibly invalid image. Run 'parted $img unit B print' manually to investigate"
|
||||||
exit -6
|
exit -6
|
||||||
fi
|
fi
|
||||||
partnum="$(echo "$parted_output" | cut -d ':' -f 1)"
|
partnum="$(echo "$parted_output" | cut -d ':' -f 1)"
|
||||||
partstart="$(echo "$parted_output" | cut -d ':' -f 2 | tr -d 'B')"
|
partstart="$(echo "$parted_output" | tail -n 1 | cut -d ':' -f 2 | tr -d 'B')"
|
||||||
loopback="$(losetup -f --show -o "$partstart" "$img")"
|
loopback="$(losetup -f --show -o "$partstart" "$img")"
|
||||||
tune2fs_output="$(tune2fs -l "$loopback")"
|
tune2fs_output="$(tune2fs -l "$loopback")"
|
||||||
currentsize="$(echo "$tune2fs_output" | grep '^Block count:' | tr -d ' ' | cut -d ':' -f 2)"
|
currentsize="$(echo "$tune2fs_output" | grep '^Block count:' | tr -d ' ' | cut -d ':' -f 2)"
|
||||||
|
|
Loading…
Reference in New Issue