Removed some checks
This commit is contained in:
parent
8a0637b3da
commit
db62822a42
25
pishrink.sh
25
pishrink.sh
|
@ -107,29 +107,11 @@ trap cleanup ERR EXIT
|
||||||
#Gather info
|
#Gather info
|
||||||
info "Gatherin data"
|
info "Gatherin data"
|
||||||
beforesize=$(ls -lh "$img" | cut -d ' ' -f 5)
|
beforesize=$(ls -lh "$img" | cut -d ' ' -f 5)
|
||||||
logVariables $LINENO beforesize
|
parted_output=$(parted -ms "$img" unit B print | tail -n 1)
|
||||||
if ! parted_output=$(parted -ms "$img" unit B print); then
|
|
||||||
rc=$?
|
|
||||||
error $LINENO "parted failed with rc $rc"
|
|
||||||
exit -6
|
|
||||||
fi
|
|
||||||
parted_output=$(tail -n 1 <<< $parted_output)
|
|
||||||
logVariables $LINENO parted_output
|
|
||||||
|
|
||||||
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" | cut -d ':' -f 2 | tr -d 'B')
|
||||||
logVariables $LINENO partnum partstart
|
loopback=$(losetup -f --show -o $partstart "$img")
|
||||||
|
tune2fs_output=$(tune2fs -l "$loopback")
|
||||||
info "Mounting image"
|
|
||||||
if ! loopback=$(losetup -f --show -o $partstart "$img"); then
|
|
||||||
rc=$?
|
|
||||||
error $LINENO "losetup failed with rc $rc"
|
|
||||||
exit -7
|
|
||||||
fi
|
|
||||||
if ! tune2fs_output=$(tune2fs -l "$loopback"); then
|
|
||||||
error $LINENO "tunefs failed"
|
|
||||||
exit -8
|
|
||||||
fi
|
|
||||||
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)
|
||||||
blocksize=$(echo "$tune2fs_output" | grep '^Block size:' | tr -d ' ' | cut -d ':' -f 2)
|
blocksize=$(echo "$tune2fs_output" | grep '^Block size:' | tr -d ' ' | cut -d ':' -f 2)
|
||||||
|
|
||||||
|
@ -285,6 +267,7 @@ if ! truncate -s $endresult "$img"; then
|
||||||
rc=$?
|
rc=$?
|
||||||
error $LINENO "trunate failed with rc $rc"
|
error $LINENO "trunate failed with rc $rc"
|
||||||
exit -16
|
exit -16
|
||||||
|
fi
|
||||||
|
|
||||||
aftersize=$(ls -lh "$img" | cut -d ' ' -f 5)
|
aftersize=$(ls -lh "$img" | cut -d ' ' -f 5)
|
||||||
logVariables $LINENO aftersize
|
logVariables $LINENO aftersize
|
||||||
|
|
Loading…
Reference in New Issue