summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rwxr-xr-xnoncore/settings/networksettings2/setmacaddress.sh15
1 files changed, 14 insertions, 1 deletions
diff --git a/noncore/settings/networksettings2/setmacaddress.sh b/noncore/settings/networksettings2/setmacaddress.sh
index f9abca2..10c6cc6 100755
--- a/noncore/settings/networksettings2/setmacaddress.sh
+++ b/noncore/settings/networksettings2/setmacaddress.sh
@@ -1,4 +1,17 @@
#!/bin/sh
+getmac() {
+ echo $5
+}
+
BDIR=/opt/QtPalmtop/etc/networktemplates
-[ ! -z "$1" -a -f ${BDIR}/$1.mac ] && ifconfig $1 hw ether `cat ${BDIR}/$1.mac`
+if [ -f ${BDIR}/$1.mac ]
+then
+# store
+ifconfig $1 hw ether `cat ${BDIR}/$1.mac`
+else
+# set
+mkdir -p $1
+i=`ifconfig $1 | grep -i hwaddr`
+getmac ${i} > ${BDIR}/$1.mac
+fi
exit 0