tar2fs: avoid duplicate fstab entry

This commit fixes duplication of root device entry in /etc/fstab
and changes LABEL=ROOT entry with the proper one if found.

Apparently this didn't hurt qemu images much though...
This commit is contained in:
Anton Midyukov 2019-09-10 02:56:41 +07:00 committed by Michael Shigorin
parent caee317e3e
commit 2ac26880f1

View File

@ -224,7 +224,11 @@ tar -C "$ROOTFS" --numeric-owner -xf "$TAR"
for i in /dev /proc /sys; do mount --bind "$i" "$ROOTFS$i"; done
# loop device so lilo could work...
if grep -qe "[[:space:]]/[[:space:]]" "$ROOTFS/etc/fstab"; then \
sed -i "s/LABEL=ROOT/$ROOTDEV/" "$ROOTFS/etc/fstab"
else
echo "$ROOTDEV / $ROOTFSTYPE relatime 1 1" >> "$ROOTFS/etc/fstab"
fi
# target device at once
if [ -n "$BOOTPART" ]; then