base-files: fix resize-ext4fs script to work with DM devices

This is needed so the encrypted rootfs is properly resized to the
partition size.

https://jira.digi.com/browse/DEL-2765

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2016-07-26 12:23:26 +02:00
parent 5726d97702
commit b37cbc26c3
1 changed files with 3 additions and 0 deletions

View File

@ -26,9 +26,12 @@ get_emmc_block_device() {
}
RESIZE2FS="$(which resize2fs)"
DM_BLOCK_DEVICE="/dev/dm-"
EMMC_BLOCK_DEVICE="$(get_emmc_block_device)"
if [ -x "${RESIZE2FS}" -a -n "${EMMC_BLOCK_DEVICE}" ]; then
PARTITIONS="$(blkid | sed -ne "{s,\(^${EMMC_BLOCK_DEVICE}[^:]\+\):.*TYPE=\"ext4\".*,\1,g;T;p}" | sort -u)"
# Add possible device mapper devices
PARTITIONS="${PARTITIONS} $(blkid | sed -ne "{s,\(^${DM_BLOCK_DEVICE}[^:]\+\):.*TYPE=\"ext4\".*,\1,g;T;p}" | sort -u)"
for i in ${PARTITIONS}; do
if ! ${RESIZE2FS} ${i} 2>/dev/null; then
echo "ERROR: resize2fs ${i}"