From: Mirko Vogt Date: Wed, 12 Dec 2012 13:41:56 +0000 (+0000) Subject: Revert "remove function find_mtd_part() from /lib/functions.sh" X-Git-Tag: reboot~12006 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=ee1770337186348b39ad3f3ab46414f98dca5740;p=openwrt%2Fstaging%2Fblogic.git 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 --- diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index 2ed353b2a560..b3a3885f2d62 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() { # { [] ... } local tmp local val="$1"