#!/bin/sh

P=/etc/netprofiles

MAHD=`find $P/* -type d -printf "%f|"`

if [ "$#" = "0" ]; then
	echo "Usage: $0 $MAHD"
else
	echo "Using profile $1"
	if [ -d $P/$1 ]; then
		cp $P/$1/$1.resolv.conf /etc/resolv.conf
		cp $P/$1/$1.hosts /etc/hosts
		cp $P/$1/$1.network /etc/sysconfig/network
		cp $P/$1/$1.ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0
		/etc/rc.d/init.d/network restart
	else
		echo "Profile $1 cannot be found ! (directory $P)"
	fi


fi

