author | wimpie <wimpie> | 2005-01-12 15:46:19 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-12 15:46:19 (UTC) |
commit | 8de401df8b396877a47cccb191098ce43bea4e0e (patch) (unidiff) | |
tree | 36d83b0b4b27c7aedfadfcd66ac93ddab11ad970 /bin | |
parent | 551fd59bc878f0f95aac939a5a9fdedd14707d17 (diff) | |
download | opie-8de401df8b396877a47cccb191098ce43bea4e0e.zip opie-8de401df8b396877a47cccb191098ce43bea4e0e.tar.gz opie-8de401df8b396877a47cccb191098ce43bea4e0e.tar.bz2 |
Script to set mac address
-rwxr-xr-x | bin/NS2SetMac.sh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/bin/NS2SetMac.sh b/bin/NS2SetMac.sh index 51810ae..e6111c7 100755 --- a/bin/NS2SetMac.sh +++ b/bin/NS2SetMac.sh | |||
@@ -1,2 +1,6 @@ | |||
1 | # store/set MAC address for given interface | 1 | # this script is part of networksettings2 package |
2 | # purpose : set fixed MAC address for network devices that | ||
3 | # have random addresses (like usb) | ||
4 | # | ||
5 | |||
2 | NS2MacStore=/etc/NS2 | 6 | NS2MacStore=/etc/NS2 |
@@ -13,3 +17,7 @@ then | |||
13 | # set this mac | 17 | # set this mac |
14 | /sbin/ifconfig $1 hw ether `cat ${NS2MacStore}/$1.mac` | 18 | X=`cat ${NS2MacStore}/$1.mac` |
19 | if [ ! -z "$X" ] | ||
20 | then | ||
21 | /sbin/ifconfig $1 hw ether $X | ||
22 | fi | ||
15 | else | 23 | else |
@@ -19,4 +27,8 @@ else | |||
19 | X=${X%% *} # remove trailing spaces | 27 | X=${X%% *} # remove trailing spaces |
28 | if [ ! -z "$X" ] | ||
29 | then | ||
30 | # valid mac address | ||
20 | echo ${X} > ${NS2MacStore}/$1.mac | 31 | echo ${X} > ${NS2MacStore}/$1.mac |
21 | fi | 32 | fi |
33 | fi | ||
22 | exit 0 | 34 | exit 0 |