base-files: define yes/no as valid boolean options
[openwrt.git] / package / base-files / files / lib / functions.sh
index 7beea0e..0d4b2a3 100755 (executable)
@@ -84,24 +84,6 @@ list() {
        list_cb "$varname" "$*"
 }
 
-config_rename() {
-       local OLD="$1"
-       local NEW="$2"
-       local oldvar
-       local newvar
-
-       [ -n "$OLD" -a -n "$NEW" ] || return
-       for oldvar in `set | grep ^CONFIG_${OLD}_ | \
-               sed -e 's/\(.*\)=.*$/\1/'` ; do
-               newvar="CONFIG_${NEW}_${oldvar##CONFIG_${OLD}_}"
-               eval "export ${NO_EXPORT:+-n} \"$newvar=\${$oldvar}\""
-               unset "$oldvar"
-       done
-       export ${NO_EXPORT:+-n} CONFIG_SECTIONS="$(echo " $CONFIG_SECTIONS " | sed -e "s, $OLD , $NEW ,")"
-
-       [ "$CONFIG_SECTION" = "$OLD" ] && export ${NO_EXPORT:+-n} CONFIG_SECTION="$NEW"
-}
-
 config_unset() {
        config_set "$1" "$2" ""
 }
@@ -120,8 +102,8 @@ config_get_bool() {
        local _tmp
        config_get _tmp "$2" "$3" "$4"
        case "$_tmp" in
-               1|on|true|enabled) _tmp=1;;
-               0|off|false|disabled) _tmp=0;;
+               1|on|true|yes|enabled) _tmp=1;;
+               0|off|false|no|disabled) _tmp=0;;
                *) _tmp="$4";;
        esac
        export ${NO_EXPORT:+-n} "$1=$_tmp"
@@ -186,6 +168,13 @@ 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