[OpenWrt-Devel,19.07] base-files: use get_mac_binary() in mtd_get_mac_binary_ubi()
diff mbox series

Message ID 20190906132328.3736-1-freifunk@adrianschmutzler.de
State Accepted, archived
Headers show
Series
  • [OpenWrt-Devel,19.07] base-files: use get_mac_binary() in mtd_get_mac_binary_ubi()
Related show

Commit Message

Adrian Schmutzler Sept. 6, 2019, 1:23 p.m. UTC
The actual retrieval of the MAC address in mtd_get_mac_binary_ubi()
is the same as in get_mac_binary(). Thus, use the latter function
in the former to reduce duplicate code.

This will also allow to benefit from the enhanced path check there
and bring mtd_get_mac_binary_ubi() more in line with the similar
mtd_get_mac_binary().

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 45600124fcbd14ece6e289cb59b318ea44c598fe)

---

The enhanced path check in get_mac_binary has been backported a while
ago. Enable mtd_get_mac_binary_ubi to use it also on 19.07.
---
 package/base-files/files/lib/functions/system.sh | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Patch
diff mbox series

diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh
index 9b9d03df7b..dceb66a851 100644
--- a/package/base-files/files/lib/functions/system.sh
+++ b/package/base-files/files/lib/functions/system.sh
@@ -79,12 +79,7 @@  mtd_get_mac_binary_ubi() {
 	local ubidev=$(nand_find_ubi $CI_UBIPART)
 	local part=$(nand_find_volume $ubidev $1)
 
-	if [ -z "$part" ]; then
-		echo "mtd_get_mac_binary: ubi volume $mtdname not found!" >&2
-		return
-	fi
-
-	hexdump -v -n 6 -s $offset -e '5/1 "%02x:" 1/1 "%02x"' /dev/$part 2>/dev/null
+	get_mac_binary "/dev/$part" "$offset"
 }
 
 mtd_get_part_size() {