aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-11-08 12:16:21 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-11-08 12:16:21 +0000
commit23cf4263246d4304323c3f732445a8f478976bac (patch)
tree7c6cc11bda37340679066abd6c0789f5f4101492 /package/base-files/files
parent7bd3a7bc7b21a98a6ba3198a3ecb94a6a16716f6 (diff)
downloadupstream-23cf4263246d4304323c3f732445a8f478976bac.tar.gz
upstream-23cf4263246d4304323c3f732445a8f478976bac.tar.bz2
upstream-23cf4263246d4304323c3f732445a8f478976bac.zip
base-files: mtd_get_mac_ascii bugfix
The mtd_get_mac_ascii utility function was broken. This fixes it. - Remove the superfluous include of /lib/functions.sh. The function is already in that file so it is pointless, - only use a variable if the whole key word matches, - don't try to process the MAC address if it is empty, - use 'tr' to canonicalize the MAC address, Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us> [juhosg: add more fixes, update commit message] Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 38690
Diffstat (limited to 'package/base-files/files')
-rwxr-xr-xpackage/base-files/files/lib/functions.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 19cfbae172..6cb6df92fd 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -248,17 +248,16 @@ mtd_get_mac_ascii()
local part
local mac_dirty
- . /lib/functions.sh
-
part=$(find_mtd_part "$mtdname")
if [ -z "$part" ]; then
echo "mtd_get_mac_ascii: partition $mtdname not found!" >&2
return
fi
- mac_dirty=$(strings "$part" | sed -n 's/'"$key"'=//p')
+ mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
+
# "canonicalize" mac
- printf "%02x:%02x:%02x:%02x:%02x:%02x" 0x${mac_dirty//:/ 0x}
+ [ -n "$mac_dirty" ] && echo ${mac_dirty} | tr [A-F] [a-f]
}
mtd_get_mac_binary() {