Do not overload mount-call - trying to reduce confusion
[openwrt.git] / package / base-files / files / lib / functions.sh
index 2ed353b..db59706 100755 (executable)
@@ -6,9 +6,6 @@
 debug () {
        ${DEBUG:-:} "$@"
 }
-mount() {
-       busybox mount "$@"
-}
 
 # newline
 N="
@@ -220,6 +217,29 @@ include() {
        done
 }
 
+find_mtd_index() {
+       local PART="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')"
+       local INDEX="${PART##mtd}"
+
+       echo ${INDEX}
+}
+
+find_mtd_part() {
+       local INDEX=$(find_mtd_index "$1")
+       local PREFIX=/dev/mtdblock
+
+       [ -d /dev/mtdblock ] && PREFIX=/dev/mtdblock/
+       echo "${INDEX:+$PREFIX$INDEX}"
+}
+
+find_mtd_chardev() {
+       local INDEX=$(find_mtd_index "$1")
+       local PREFIX=/dev/mtd
+
+       [ -d /dev/mtd ] && PREFIX=/dev/mtd/
+       echo "${INDEX:+$PREFIX$INDEX}"
+}
+
 strtok() { # <string> { <variable> [<separator>] ... }
        local tmp
        local val="$1"