summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authormirko <mirko@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-12-12 13:41:56 +0000
committermirko <mirko@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-12-12 13:41:56 +0000
commitfeb7e4aff9207e8904c067947369e2ae868ba5e9 (patch)
tree759ebfc7541ecf85f4355619c8623b960def07ba /package
parent877ab89dabc3819bccbb1ccf87e9b1efec6e2cb9 (diff)
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. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34642 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-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 2ed353b2a5..b3a3885f2d 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"