Added some more dbug logs

This commit is contained in:
framp 2020-01-09 13:21:55 +01:00
parent 4f61a3244a
commit 9de4f53b96
1 changed files with 11 additions and 11 deletions

View File

@ -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