#!/bin/sh
##########################################################################
##                                                                      ##
## configure $ROOTFS/etc/hosts                                          ##
##                                                                      ##
## This program is free software; you can redistribute it and/or modify ##
## it under the terms of the GNU General Public License as published by ##
## the Free Software Foundation; either version 2 of the License, or    ##
## (at your option) any later version.                                  ##
##                                                                      ##
##########################################################################

. config_build
. config_system
. "$SCRIPTS"/misc/lib/lib_fail

if [ "$DHCP" = "yes" ]; then
    exit 0
fi

echo "----------------------------------"
echo "      configuring /etc/hosts      "
echo "----------------------------------"
echo 
echo

# backup the old hosts
cp $ROOTFS/etc/hosts $BACKUPDIR/

HOSTNAME=$(cat $ROOTFS/etc/hostname)

cat <<EOF > $ROOTFS/etc/hosts
127.0.0.1       localhost
$INET 		$HOSTNAME

# The following lines are desirable for IPv6 capable hosts
# (added automatically by netbase upgrade)

::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
EOF

echo


