#!/bin/sh
#
# ROCK Linux: /bin/confnet  (rescue disk only)
#

if [ -z "$3" ]
then
	echo "Usage: $0 {if} {ipaddr} {netmask} [ {gateway} ] [ {nameserver} ]"
	exit 1
fi

ifconfig $1 $2 netmask $3 up

if [ "$4" ] ; then
	route add default gw $4 dev $1
fi

if [ "$5" ] ; then
	echo -e "nameserver\t$5" > /etc/resolv.conf
fi

echo -e "$2\tthishost" >> /etc/hosts
echo "thishost" > /proc/sys/kernel/hostname
