don't fiddle around with /etc/hosts
authorEvgeni Golov <evgeni@grml.org>
Tue, 24 Jan 2017 21:53:56 +0000 (22:53 +0100)
committerEvgeni Golov <evgeni@grml.org>
Tue, 24 Jan 2017 21:53:56 +0000 (22:53 +0100)
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

chroot-script
grml-debootstrap

index 256ae60..eb2963f 100755 (executable)
@@ -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
 }
index 61dab37..47e4e5c 100755 (executable)
@@ -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