#!/bin/sh

#     DESCRIPTION
#
# Setup network settings
# 1. Truncate /etc/resolv.conf
# 2. Init /etc/hosts with "127.0.0.1 localhost"
# 3. Set hostname, domainname


#     REQUIRES
#
# Define $SUITE variable XXX:


#     INFO
#

NAME="init3-network"

verbose()
{
    if [ -n "$GLOBAL_VERBOSE" ]; then
        echo "HOOK: $NAME: $@"
    fi
}

verbose "has started"

DOMAINNAME="localhost"
HOSTNAME="$SUITE"

verbose "Init /etc/hosts with 127.0.0.1 localhost"
/bin/echo "127.0.0.1 localhost" > /etc/hosts

verbose "Truncate /etc/resolv.conf"
/bin/echo >/etc/resolv.conf

verbose "Enable networking, disable FORWARD_IPV4, set hostname to $HOSTNAME, domainname to $DOMAINNAME"
cat << __EOF__ >> /etc/sysconfig/network
NETWORKING=yes
FORWARD_IPV4=false
HOSTNAME=$HOSTNAME
DOMAINNAME=$DOMAINNAME
__EOF__

cat << __EOF__ >> /etc/HOSTNAME
$HOSTNAME.$DOMAINNAME
__EOF__

verbose "finished"
