projects
/
openwrt
/
staging
/
mkresin.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9813eb4
)
fixes for common config functions
author
Felix Fietkau
<nbd@openwrt.org>
Sun, 25 Jun 2006 15:32:30 +0000
(15:32 +0000)
committer
Felix Fietkau
<nbd@openwrt.org>
Sun, 25 Jun 2006 15:32:30 +0000
(15:32 +0000)
SVN-Revision: 4071
openwrt/package/base-files/default/etc/functions.sh
patch
|
blob
|
history
diff --git
a/openwrt/package/base-files/default/etc/functions.sh
b/openwrt/package/base-files/default/etc/functions.sh
index fbb5a160c45ff5678f3c4c8995f518db39c1f4c7..e87515d6eaaf3bf02167037bde2c14b962a8e5f6 100755
(executable)
--- a/
openwrt/package/base-files/default/etc/functions.sh
+++ b/
openwrt/package/base-files/default/etc/functions.sh
@@
-5,6
+5,8
@@
alias debug=${DEBUG:-:}
N="
"
N="
"
+_C=0
+
# valid interface?
if_valid () (
ifconfig "$1" >&- 2>&- ||
# valid interface?
if_valid () (
ifconfig "$1" >&- 2>&- ||
@@
-23,18
+25,24
@@
append() {
eval "export ${var}=\"\${${var}:+\${${var}}${value:+$sep}}$value\""
}
eval "export ${var}=\"\${${var}:+\${${var}}${value:+$sep}}$value\""
}
-config_cb() {
- return 0
-}
-option_cb() {
- return 0
+reset_cb() {
+ config_cb() {
+ return 0
+ }
+ option_cb() {
+ return 0
+ }
}
}
+reset_cb
config () {
config () {
- config_cb "$@"
- _C=$((${_C:-0} + 1))
- export CONFIG_SECTION="${2:-cfg${_C}}"
- export CONFIG_${CONFIG_SECTION}_TYPE="$1"
+ local type="$1"
+ local name="$2"
+ _C=$(($_C + 1))
+ name="${name:-cfg${_C}}"
+ config_cb "$type" "$name"
+ export CONFIG_SECTION="$name"
+ export CONFIG_${CONFIG_SECTION}_TYPE="$type"
}
option () {
}
option () {
@@
-53,12
+61,16
@@
config_clear() {
}
config_load() {
}
config_load() {
- local CD=""
- if [ \! -e "$1" -a -e "/etc/config/$1" ]; then
- cd /etc/config && local CD=1
- fi
- [ -e "$1" ] && . $1
- ${CD:+cd - >/dev/null}
+ local DIR="./"
+ _C=0
+ [ \! -e "$1" -a -e "/etc/config/$1" ] && {
+ DIR="/etc/config/"
+ }
+ [ -e "$DIR$1" ] && {
+ CONFIG_FILENAME="$DIR$1"
+ . ${CONFIG_FILENAME}
+ } || return 1
+ ${CD:+cd -} >/dev/null
${CONFIG_SECTION:+config_cb}
}
${CONFIG_SECTION:+config_cb}
}