From: Michael Prokop Date: Wed, 25 Jan 2017 23:46:41 +0000 (+0100) Subject: Don't generate rootfs entry in /etc/fstab if we don't know its UUID [Closes: issue2182] X-Git-Tag: v0.78~2 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=622fa874a2ecc04fec77cbb455419f4618112f9e Don't generate rootfs entry in /etc/fstab if we don't know its UUID [Closes: issue2182] With a command line like: grml-debootstrap --grub /dev/sda -t /media/sda1 ... the resulting fstab gets: /media/sda1 / auto defaults,errors=remount-ro 0 1 which is for sure unwanted. So don't such an entry in the fstab if we lack details about the underlying rootfs and instead warn the user that this *might* be a problem. --- diff --git a/chroot-script b/chroot-script index eb2963f..7d8c6d2 100755 --- a/chroot-script +++ b/chroot-script @@ -463,12 +463,12 @@ timezone() { # helper function for fstab() {{{ createfstab(){ - echo "Setting up /etc/fstab" -if [ -n "$TARGET_UUID" ] ; then - echo "/dev/disk/by-uuid/${TARGET_UUID} / auto defaults,errors=remount-ro 0 1" > /etc/fstab -else - echo "${TARGET} / auto defaults,errors=remount-ro 0 1" > /etc/fstab -fi + echo "Setting up /etc/fstab" + if [ -n "$TARGET_UUID" ] ; then + echo "/dev/disk/by-uuid/${TARGET_UUID} / auto defaults,errors=remount-ro 0 1" > /etc/fstab + else + echo "Warning: couldn't identify target UUID for rootfs, your /etc/fstab might be incomplete." + fi if [ -n "$EFI" ] ; then echo "UUID=$(blkid -o value -s UUID $EFI) /boot/efi vfat umask=0077 0 1" >> /etc/fstab