X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=chroot-script;h=7d8c6d211c9e8cdcac5a6a9b1bf9f13192b34afa;hp=256ae60dd2a537f81803441dfd4632a1dddc76cb;hb=7803bf372239c4aa67e7e60de715f311232e7b7b;hpb=10ad4699c352b3537625085370051b9be83d2036 diff --git a/chroot-script b/chroot-script index 256ae60..7d8c6d2 100755 --- a/chroot-script +++ b/chroot-script @@ -427,24 +427,12 @@ passwords() # set up /etc/hosts {{{ hosts() { - if [ -f /etc/hosts ] ; then - sed -i "s#127.0.0.1 .*#127.0.0.1 localhost $HOSTNAME#" /etc/hosts - [ -n "$HOSTNAME" ] && sed -i "s/grml/$HOSTNAME/g" /etc/hosts - else + if ! [ -f /etc/hosts ] ; then cat > /etc/hosts << EOF -127.0.0.1 localhost $HOSTNAME - -#127.0.0.1 localhost -#127.0.1.1 $HOSTNAME.example.org $HOSTNAME - -# The following lines are desirable for IPv6 capable hosts -#::1 ip6-localhost ip6-loopback $HOSTNAME -::1 ip6-localhost ip6-loopback -fe00::0 ip6-localnet -ff00::0 ip6-mcastprefix -ff02::1 ip6-allnodes -ff02::2 ip6-allrouters -ff02::3 ip6-allhosts +127.0.0.1 localhost +::1 localhost ip6-localhost ip6-loopback +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters EOF fi } @@ -475,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