From: Evgeni Golov Date: Tue, 24 Jan 2017 21:53:56 +0000 (+0100) Subject: don't fiddle around with /etc/hosts X-Git-Tag: v0.78~4 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=36a961d4534d6c6476e2416776fda21d1806b4b5 don't fiddle around with /etc/hosts netbase generates a nice /etc/hosts for us since squeeze. for the weird case it did not (ohai lenny!), deploy the version netbase in stretch has. Fixes: #94 --- diff --git a/chroot-script b/chroot-script index 256ae60..eb2963f 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 } diff --git a/grml-debootstrap b/grml-debootstrap index 61dab37..47e4e5c 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -1441,11 +1441,6 @@ preparechroot() { # make sure we can access network [relevant for cdebootstrap] [ -f "${MNTPOINT}"/etc/resolv.conf ] || cp $VERBOSE /etc/resolv.conf "${MNTPOINT}"/etc/resolv.conf - # provide system's /etc/hosts to the target: - if ! [ -f "$MNTPOINT/etc/hosts" ] ; then - cp $VERBOSE /etc/hosts "${MNTPOINT}"/etc/hosts - fi - # setup default locales [ -n "$LOCALES" ] && cp $VERBOSE "${CONFFILES}"/locale.gen "${MNTPOINT}"/etc/locale.gen