2 # Copyright (C) 2006 OpenWrt.org
3 # Copyright (C) 2006 Fokus Fraunhofer <carsten.tittel@fokus.fraunhofer.de>
5 alias debug
=${DEBUG:-:}
15 env
-i ACTION
=$1 INTERFACE
=$2 /sbin
/hotplug net
23 eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\""
27 config_cb
() { return 0; }
28 option_cb
() { return 0; }
36 export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS
=$
(($CONFIG_NUM_SECTIONS + 1))
37 name
="${name:-cfg$CONFIG_NUM_SECTIONS}"
38 append CONFIG_SECTIONS
"$name"
39 config_cb
"$cfgtype" "$name"
40 export ${NO_EXPORT:+-n} CONFIG_SECTION
="$name"
41 export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_TYPE=$cfgtype"
45 local varname
="$1"; shift
48 export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_${varname}=$value"
49 option_cb "$varname" "$
*"
58 [ "$OLD" -a "$NEW" ] || return
59 for oldvar in `set | grep ^CONFIG_${OLD}_ | \
60 sed -e 's/\(.*\)=.*$/\1/'` ; do
61 newvar="CONFIG_
${NEW}_${oldvar##CONFIG_${OLD}_}"
62 eval "export ${NO_EXPORT:+-n} \"$newvar=\
${$oldvar}\""
65 export ${NO_EXPORT:+-n} CONFIG_SECTIONS="$
(echo " $CONFIG_SECTIONS " |
sed -e "s, $OLD , $NEW ,")"
67 [ "$CONFIG_SECTION" = "$OLD" ] && export ${NO_EXPORT:+-n} CONFIG_SECTION="$NEW"
71 config_set "$1" "$2" ""
78 export ${NO_EXPORT:+-n} CONFIG_SECTIONS="$
(echo " $CONFIG_SECTIONS " |
sed -e "s, $OLD , ,")"
79 export ${NO_EXPORT:+-n} CONFIG_SECTIONS="${SECTION:+$CONFIG_SECTIONS}"
81 for oldvar in `set | grep ^CONFIG_${SECTION:+${SECTION}_} | \
82 sed -e 's/\(.*\)=.*$/\1/'` ; do
88 local file="$UCI_ROOT/etc
/config
/$1"
90 export ${NO_EXPORT:+-n} CONFIG_SECTIONS=
91 export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=0
92 export ${NO_EXPORT:+-n} CONFIG_SECTION=
98 ${CONFIG_SECTION:+config_cb}
103 "") eval "echo \"\
${CONFIG_${1}_${2}}\"";;
104 *) eval "export ${NO_EXPORT:+-n} -- \"$1=\${CONFIG_${2}_${3}}\"";;
108 # config_get_bool <variable> <section> <option> [<default>]
111 config_get "_tmp
" "$2" "$3"
113 1|on|enabled) export ${NO_EXPORT:+-n} "$1=1";;
114 0|off|disabled) export ${NO_EXPORT:+-n} "$1=0";;
115 *) eval "$1=${4:-0}";;
123 export ${NO_EXPORT:+-n} "CONFIG_${section}_${option}=$value"
129 local section cfgtype
131 [ -z "$CONFIG_SECTIONS" ] && return 0
132 for section
in ${CONFIG_SECTIONS}; do
133 config_get cfgtype
"$section" TYPE
134 [ -n "$type" -a "$cfgtype" != "$type" ] && continue
135 eval "$function \"\$section\""
141 sed 's/^[^#]/insmod &/' $
* | ash
2>&- ||
:
147 for file in $
(ls $1/*.sh
2>/dev
/null
); do
153 local PART
="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')"
154 local PREFIX
=/dev
/mtdblock
157 [ -d /dev
/mtdblock
] && PREFIX
=/dev
/mtdblock
/
158 echo "${PART:+$PREFIX$PART}"
161 strtok
() { # <string> { <variable> [<separator>] ... }
168 while [ $# -gt 1 ]; do
171 [ "$tmp" = "$val" ] && break
175 export ${NO_EXPORT:+-n} "$1=$tmp"; count
=$
((count
+1))
179 if [ $# -gt 0 -a "$val" ]; then
180 export ${NO_EXPORT:+-n} "$1=$val"; count
=$
((count
+1))
This page took 0.062915 seconds and 5 git commands to generate.