#!/bin/bash # ************************************************************ # AltEPG Project Source Code Version Control # $FileID: git::root/hack/bin/setNic.bash $ # $Revision: altepg1.0c root 2011-09-17 23:39:32 +0100 Finalising altepg1.0c $ # Description: Set NIC parameters (invoked from TClient-lib.itcl) # ************************************************************ nic=$1 ip=$2 gw=$3 mask=$4 SEDEXP=/var/tmp/sedexp >$SEDEXP if [ -n "$nic" ]; then echo "s/nic=.*/nic=$nic/g;" >>$SEDEXP; fi if [ -n "$ip" ]; then echo "s/ip=.*/ip=$ip/g;" >>$SEDEXP; fi if [ -n "$gw" ]; then echo "s/gateway=.*/gateway=$gw/g;" >>$SEDEXP; fi if [ -n "$mask" ]; then echo "s/netmask=.*/netmask=$mask/g;" >>$SEDEXP; fi # mode=test # delete this line for normal operation confdir="/etc" rw="mount -o remount,rw /" ro="mount -o remount,ro /" if [ "$mode" = "test" ]; then rw=":" ro=":" confdir="." fi conf=$confdir/oztivo.conf confnew=$confdir/oztivo.conf.new confold=$confdir/oztivo.conf.old $rw sed -f $SEDEXP <$conf >$confnew if [ $? = 0 ]; then rm -f $confold mv $conf $confold mv $confnew $conf echo "nic set to $nic in $conf" else echo "error $? setting nic to $nic in $conf" fi $ro