aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-core/udev/udev/nokia900/nokia-n900-mac-hack.sh
blob: c0b8251ae96536c9da9c6fa75388e09175430fc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

if [ $# -ne 2 ]; then
	echo "Usage: $0 iface newmac"
	echo "       newmac is only saved if /etc/<iface>MAC is not found"
	exit 1
fi

iface="$1"
newmac="$2"
macfile=/etc/"$iface"mac

# If no MAC is found, save the one given as argument
if [ ! -e $macfile ]; then
   /bin/echo "$newmac" > $macfile
# Otherwise load MAC from file
else
   newmac=`/bin/cat $macfile`
fi

# Configure interface
/sbin/ifconfig "$iface" down
/sbin/ifconfig "$iface" hw ether $newmac