ramips: move ramips_get_mac_* functions to lib/ramips.sh
authorGabor Juhos <juhosg@openwrt.org>
Mon, 5 Dec 2011 17:27:03 +0000 (17:27 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Mon, 5 Dec 2011 17:27:03 +0000 (17:27 +0000)
SVN-Revision: 29451

target/linux/ramips/base-files/etc/uci-defaults/network
target/linux/ramips/base-files/lib/ramips.sh

index 5891b480c1dd0f88906ff6b52348b8f246ddd946..489057dfd7c77ffa4a8a669c7aa2f9b5eb16bc69 100755 (executable)
@@ -9,39 +9,6 @@ if [ ! -x /usr/sbin/maccalc ]; then
        return
 fi
 
-ramips_get_mac_binary()
-{
-       local mtdname="$1"
-       local seek="$2"
-       local part
-
-       part=$(find_mtd_part "$mtdname")
-       if [ -z "$part" ]; then
-               echo "ramips_get_mac_binary: partition $mtdname not found!" >&2
-               return
-       fi
-
-       dd bs=1 skip=$seek count=6 if=$part 2>/dev/null | /usr/sbin/maccalc bin2mac
-}
-
-ramips_get_mac_nvram()
-{
-       local mtdname="$1"
-       local key="$2"
-       local part
-       local mac_dirty
-
-       part=$(find_mtd_part "$mtdname")
-       if [ -z "$part" ]; then
-               echo "ramips_get_mac_nvram: partition $mtdname not found!" >&2
-               return
-       fi
-
-       mac_dirty=$(strings "$part" | sed -n 's/'"$key"'=//p')
-       # "canonicalize" mac
-       maccalc add "$mac_dirty" 0
-}
-
 ramips_setup_interfaces()
 {
        local board="$1"
index de37e69a6cbba3fd17e31a3bf86db00688b42d3c..b41a153ca939537e832a0808154e96b9cfadc2a0 100755 (executable)
@@ -3,6 +3,43 @@
 # Copyright (C) 2010 OpenWrt.org
 #
 
+ramips_get_mac_binary()
+{
+       local mtdname="$1"
+       local seek="$2"
+       local part
+
+       . /lib/functions.sh
+
+       part=$(find_mtd_part "$mtdname")
+       if [ -z "$part" ]; then
+               echo "ramips_get_mac_binary: partition $mtdname not found!" >&2
+               return
+       fi
+
+       dd bs=1 skip=$seek count=6 if=$part 2>/dev/null | /usr/sbin/maccalc bin2mac
+}
+
+ramips_get_mac_nvram()
+{
+       local mtdname="$1"
+       local key="$2"
+       local part
+       local mac_dirty
+
+       . /lib/functions.sh
+
+       part=$(find_mtd_part "$mtdname")
+       if [ -z "$part" ]; then
+               echo "ramips_get_mac_nvram: partition $mtdname not found!" >&2
+               return
+       fi
+
+       mac_dirty=$(strings "$part" | sed -n 's/'"$key"'=//p')
+       # "canonicalize" mac
+       /usr/sbin/maccalc add "$mac_dirty" 0
+}
+
 ramips_board_name() {
        local machine
        local name