allow config_* and uci_* functions to work on files outside of /etc/config - these...
[openwrt.git] / package / base-files / files / etc / functions.sh
index dac46a3..7ba59af 100755 (executable)
@@ -85,7 +85,11 @@ config_clear() {
 }
 
 config_load() {
-       local file="$UCI_ROOT/etc/config/$1"
+       local file
+       case "$1" in
+               /*) file="$1";;
+               *) file="$UCI_ROOT/etc/config/$1";;
+       esac
        _C=0
        export ${NO_EXPORT:+-n} CONFIG_SECTIONS=
        export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=0
@@ -141,8 +145,10 @@ config_foreach() {
 }
 
 load_modules() {
-       cd /etc/modules.d
-       sed 's/^[^#]/insmod &/' $* | ash 2>&- || :
+       [ -d /etc/modules.d ] && {
+               cd /etc/modules.d
+               sed 's/^[^#]/insmod &/' $* | ash 2>&- || :
+       }
 }
 
 include() {
@@ -186,3 +192,13 @@ strtok() { # <string> { <variable> [<separator>] ... }
 
        return $count
 }
+
+
+jffs2_mark_erase() {
+       local part="$(find_mtd_part "$1")"
+       [ -z "$part" ] && {
+               echo Partition not found.
+               return 1
+       }
+       echo -e "\xde\xad\xc0\xde" | mtd -qq write - "$1"
+}
This page took 0.022871 seconds and 4 git commands to generate.