#!/bin/sh
#########################################
#	setdhcp	v0.2	2015/07/29
#	written by h2y
#########################################

# Check argument
if [ $# -ne 1 ]; then
	echo "Usage: setdhcp [interface name]"
	exit 1
fi

IFCFG_FILE=/etc/sysconfig/network-scripts/ifcfg-$1

if [ ! -f $IFCFG_FILE ]; then
	echo "File not found ($IFCFG_FILE)"
	exit 1
fi

/bin/sed -i '/^BOOTPROTO=/c \BOOTPROTO=dhcp' $IFCFG_FILE

/etc/init.d/network restart

