+ # Get rootfs size
+ if echo "${SDIMG_ROOTFS_TYPE}" | egrep -q "*\.xz"
+ then
+ ROOTPART_SIZE=`xz -l --robot ${SDIMG_ROOTFS} | grep "^file" | cut -f`
+ else
+ ROOTPART_SIZE=`du -Lb ${SDIMG_ROOTFS} | cut -f1`
+ fi
+
+ ROOTPART_SIZE=$(expr ${ROOTPART_SIZE} / 1024)
+
+ # just in case our file system block size is not a multiple of 1KiB
+ if [ $(expr ${ROOTPART_SIZE} % 1024) != 0 ];
+ then
+ ROOTPART_SIZE=$(expr ${ROOTPART_SIZE} + 1)
+ fi
+