From: nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Thu, 26 Oct 2006 01:35:50 +0000 (+0000)
Subject: add lookup function for mtd parts
X-Git-Url: https://git.rohieb.name/openwrt.git/commitdiff_plain/11f6a780e57e9febfa701f688575dfc79cc1f970

add lookup function for mtd parts

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@5299 3c298f89-4303-0410-b956-a3cf2f4a3e73
---

diff --git a/package/base-files/default/etc/functions.sh b/package/base-files/default/etc/functions.sh
index 2abb6f81c..bf87548ca 100755
--- a/package/base-files/default/etc/functions.sh
+++ b/package/base-files/default/etc/functions.sh
@@ -110,3 +110,10 @@ include() {
 		. $file
 	done
 }
+
+find_mtd_part() {
+	local PART="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')"
+	PART="${PART##mtd}"
+	echo "${PART:+/dev/mtdblock/$PART}"
+}
+