Added some more dbug logs
This commit is contained in:
parent
4f61a3244a
commit
9de4f53b96
20
pishrink.sh
20
pishrink.sh
|
@ -159,16 +159,16 @@ 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)"
|
||||||
parted_output=$(parted -ms "$img" unit B print | tail -n 1)
|
parted_output="$(parted -ms "$img" unit B print | tail -n 1)"
|
||||||
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')"
|
||||||
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)"
|
||||||
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)"
|
||||||
|
|
||||||
logVariables $LINENO tune2fs_output currentsize blocksize
|
logVariables $LINENO beforesize parted_output partnum partstart tune2fs_output currentsize blocksize
|
||||||
|
|
||||||
#Check if we should make pi expand rootfs on next boot
|
#Check if we should make pi expand rootfs on next boot
|
||||||
if [ "$should_skip_autoexpand" = false ]; then
|
if [ "$should_skip_autoexpand" = false ]; then
|
||||||
|
@ -264,7 +264,7 @@ if ! minsize=$(resize2fs -P "$loopback"); then
|
||||||
exit -10
|
exit -10
|
||||||
fi
|
fi
|
||||||
minsize=$(cut -d ':' -f 2 <<< "$minsize" | tr -d ' ')
|
minsize=$(cut -d ':' -f 2 <<< "$minsize" | tr -d ' ')
|
||||||
logVariables $LINENO minsize
|
logVariables $LINENO currentsize minsize
|
||||||
if [[ $currentsize -eq $minsize ]]; then
|
if [[ $currentsize -eq $minsize ]]; then
|
||||||
error $LINENO "Image already shrunk to smallest size"
|
error $LINENO "Image already shrunk to smallest size"
|
||||||
exit -11
|
exit -11
|
||||||
|
|
Loading…
Reference in New Issue