summaryrefslogtreecommitdiff
path: root/package/base-files
diff options
context:
space:
mode:
authorMirko Vogt <mirko@openwrt.org>2012-12-12 13:41:56 +0000
committerMirko Vogt <mirko@openwrt.org>2012-12-12 13:41:56 +0000
commitee1770337186348b39ad3f3ab46414f98dca5740 (patch)
tree4ec4123d0b9ede34c7a1072ac25b0842d623ac93 /package/base-files
parent1521cdda0fcdcdecf98b5016ee55f9da1e306279 (diff)
downloadmtk-20170518-ee1770337186348b39ad3f3ab46414f98dca5740.zip
mtk-20170518-ee1770337186348b39ad3f3ab46414f98dca5740.tar.gz
mtk-20170518-ee1770337186348b39ad3f3ab46414f98dca5740.tar.bz2
Revert "remove function find_mtd_part() from /lib/functions.sh"
Reverting commit 34641. Function find_mtd_part() is needed by some scripts deployed for certain targets but not including boot.sh after all. Still, all this certainly needs some love. SVN-Revision: 34642
Diffstat (limited to 'package/base-files')
-rwxr-xr-xpackage/base-files/files/lib/functions.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 2ed353b..b3a3885 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -220,6 +220,15 @@ include() {
done
}
+find_mtd_part() {
+ local PART="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')"
+ local PREFIX=/dev/mtdblock
+
+ PART="${PART##mtd}"
+ [ -d /dev/mtdblock ] && PREFIX=/dev/mtdblock/
+ echo "${PART:+$PREFIX$PART}"
+}
+
strtok() { # <string> { <variable> [<separator>] ... }
local tmp
local val="$1"