2 # Copyright (C) 2006 OpenWrt.org
3 # Copyright (C) 2006 Fokus Fraunhofer <carsten.tittel@fokus.fraunhofer.de>
5 alias debug
=${DEBUG:-:}
16 env
-i ACTION
=$1 INTERFACE
=$2 /sbin
/hotplug-call net
24 eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\""
32 eval "val=\" \${$var} \""
33 [ "${val%% $str *}" != "$val" ]
41 eval "val=\" \${$var} \""
42 val1
="${val%% $remove *}"
43 [ "$val1" = "$val" ] && return
44 val2
="${val##* $remove }"
45 [ "$val2" = "$val" ] && return
46 val
="${val1## } ${val2%% }"
48 eval "export ${NO_EXPORT:+-n} -- \"$var=\$val\""
52 [ -n "$IPKG_INSTROOT" ] && return 0
57 config_cb
() { return 0; }
58 option_cb
() { return 0; }
70 export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS
=$
(($CONFIG_NUM_SECTIONS + 1))
71 name
="${name:-cfg$CONFIG_NUM_SECTIONS}"
72 append CONFIG_SECTIONS
"$name"
73 [ -n "$NO_CALLBACK" ] || config_cb
"$cfgtype" "$name"
74 export ${NO_EXPORT:+-n} CONFIG_SECTION
="$name"
75 export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_TYPE=$cfgtype"
79 local varname
="$1"; shift
82 export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_${varname}=$value"
83 [ -n "$NO_CALLBACK" ] || option_cb "$varname" "$
*"
92 [ -n "$OLD" -a -n "$NEW" ] || return
93 for oldvar in `set | grep ^CONFIG_${OLD}_ | \
94 sed -e 's/\(.*\)=.*$/\1/'` ; do
95 newvar="CONFIG_
${NEW}_${oldvar##CONFIG_${OLD}_}"
96 eval "export ${NO_EXPORT:+-n} \"$newvar=\
${$oldvar}\""
99 export ${NO_EXPORT:+-n} CONFIG_SECTIONS="$
(echo " $CONFIG_SECTIONS " |
sed -e "s, $OLD , $NEW ,")"
101 [ "$CONFIG_SECTION" = "$OLD" ] && export ${NO_EXPORT:+-n} CONFIG_SECTION="$NEW"
105 config_set "$1" "$2" ""
112 list_remove CONFIG_SECTIONS "$SECTION"
113 export ${NO_EXPORT:+-n} CONFIG_SECTIONS="${SECTION:+$CONFIG_SECTIONS}"
115 for oldvar in `set | grep ^CONFIG_${SECTION:+${SECTION}_} | \
116 sed -e 's/\(.*\)=.*$/\1/'` ; do
123 "") eval "echo \"\
${CONFIG_${1}_${2}}\"";;
124 *) eval "export ${NO_EXPORT:+-n} -- \"$1=\${CONFIG_${2}_${3}}\"";;
128 # config_get_bool <variable> <section> <option> [<default>]
131 config_get "_tmp
" "$2" "$3"
133 1|on|true|enabled) export ${NO_EXPORT:+-n} "$1=1";;
134 0|off|false|disabled) export ${NO_EXPORT:+-n} "$1=0";;
143 local old_section="$CONFIG_SECTION"
145 CONFIG_SECTION="$section"
146 option "$option" "$value"
147 CONFIG_SECTION="$old_section"
152 [ "$#" -ge 1 ] && shift
154 [ "$#" -ge 1 ] && shift
155 local section cfgtype
157 [ -z "$CONFIG_SECTIONS" ] && return 0
158 for section in ${CONFIG_SECTIONS}; do
159 config_get cfgtype "$section" TYPE
160 [ -n "$type" -a "x
$cfgtype" != "x
$type" ] && continue
161 eval "$function \"\
$section\" \"\$@
\""
166 [ -d /etc/modules.d ] && {
168 sed 's/^[^#]/insmod &/' $* | ash 2>&- || :
175 for file in $(ls $1/*.sh 2>/dev/null); do
181 local PART="$
(grep "\"$1\"" /proc
/mtd |
awk -F: '{print $1}')"
182 local PREFIX=/dev/mtdblock
185 [ -d /dev/mtdblock ] && PREFIX=/dev/mtdblock/
186 echo "${PART:+$PREFIX$PART}"
189 strtok() { # <string> { <variable> [<separator>] ... }
196 while [ $# -gt 1 ]; do
199 [ "$tmp" = "$val" ] && break
203 export ${NO_EXPORT:+-n} "$1=$tmp"; count=$((count+1))
207 if [ $# -gt 0 -a -n "$val" ]; then
208 export ${NO_EXPORT:+-n} "$1=$val"; count=$((count+1))
216 local part="$
(find_mtd_part
"$1")"
218 echo Partition not found.
221 echo -e "\xde\xad\xc0\xde" | mtd -qq write - "$1"
224 uci_apply_defaults() {(
225 cd /etc/uci-defaults || return 0
227 [ -z "$files" ] && return 0
229 for file in $files; do
230 ( . ".
/$
(basename $file)" ) && rm -f "$file"
235 [ -z "$IPKG_INSTROOT" -a -f /lib/config/uci.sh ] && . /lib/config/uci.sh
This page took 0.062863 seconds and 5 git commands to generate.