#!/bin/sh # e2k: /boot *needs* to be on ext2, /vm doesn't make that too easy # https://bugzilla.altlinux.org/34600 [ `arch` = 'e2k' ] || exit 0 . install2-init-functions # uuid -> partition boot_uuid="$(sed -rn 's,^UUID=(.*)+\s+/boot\s+ext[34]\s+.*,\1,p' $destdir/etc/fstab)" echo "** boot_uuid=$boot_uuid" >&2 boot_dev="$(blkid --uuid "$boot_uuid")" echo "** boot_dev=$boot_dev" >&2 # /boot is ext2 already (just fine) OR missing totally # (which will bail out either but it's too late here anyways) [ -b "$boot_dev" ] || exit 0 # backup... cp -av $destdir/boot /tmp umount -v $destdir/boot # tune2fs can't turn extents off, gotta remake the filesystem mkfs.ext2 -F "$boot_dev" || exit 1 uuid="$(blkid "$boot_dev" -s UUID | sed -n -e 's/^.*UUID="\([^"]\+\)".*/\1/p')" echo "** uuid=$uuid" >&2 [ -n "$uuid" ] || exit 1 # make that official sed -i "/^UUID=$boot_uuid/ {s/$boot_uuid/$uuid/;s/ext[34]/ext2/}" $destdir/etc/fstab # ...restore mount -v "$boot_dev" $destdir/boot || exit 1 cp -av /tmp/boot $destdir && rm -rf /tmp/boot || exit 1