projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix more instances of '' abuse
[openwrt.git]
/
package
/
base-files
/
default
/
etc
/
functions.sh
diff --git
a/package/base-files/default/etc/functions.sh
b/package/base-files/default/etc/functions.sh
index
fbb5a16
..
27b0a6d
100755
(executable)
--- a/
package/base-files/default/etc/functions.sh
+++ b/
package/base-files/default/etc/functions.sh
@@
-1,10
+1,15
@@
#!/bin/sh
#!/bin/sh
+# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2006 Fokus Fraunhofer <carsten.tittel@fokus.fraunhofer.de>
+
alias debug=${DEBUG:-:}
# newline
N="
"
alias debug=${DEBUG:-:}
# newline
N="
"
+_C=0
+
# valid interface?
if_valid () (
ifconfig "$1" >&- 2>&- ||
# valid interface?
if_valid () (
ifconfig "$1" >&- 2>&- ||
@@
-23,22
+28,28
@@
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 cfgtype="$1"
+ local name="$2"
+ _C=$(($_C + 1))
+ name="${name:-cfg${_C}}"
+ config_cb "$cfgtype" "$name"
+ export CONFIG_SECTION="$name"
+ export CONFIG_${CONFIG_SECTION}_TYPE="$cfgtype"
}
option () {
}
option () {
- local varname="$1"
; shift
+ local varname="$1"; shift
export CONFIG_${CONFIG_SECTION}_${varname}="$*"
option_cb "$varname" "$*"
}
export CONFIG_${CONFIG_SECTION}_${varname}="$*"
option_cb "$varname" "$*"
}
@@
-53,12
+64,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}
}
@@
-76,3
+91,9
@@
config_set() {
load_modules() {
sed 's/^[^#]/insmod &/' $* | ash 2>&- || :
}
load_modules() {
sed 's/^[^#]/insmod &/' $* | ash 2>&- || :
}
+
+include() {
+ for file in $(ls /lib/$1/*.sh 2>/dev/null); do
+ . $file
+ done
+}
This page took
0.026979 seconds
and
4
git commands to generate.