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-call 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 [ -n "$NO_CALLBACK" ] || 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 [ -n "$NO_CALLBACK" ] || option_cb "$varname" "$
*"
58 [ -n "$OLD" -a -n "$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
91 *) file="$UCI_ROOT/etc
/config
/$1";;
94 export ${NO_EXPORT:+-n} CONFIG_SECTIONS=
95 export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=0
96 export ${NO_EXPORT:+-n} CONFIG_SECTION=
102 ${CONFIG_SECTION:+config_cb}
107 "") eval "echo \"\
${CONFIG_${1}_${2}}\"";;
108 *) eval "export ${NO_EXPORT:+-n} -- \"$1=\${CONFIG_${2}_${3}}\"";;
112 # config_get_bool <variable> <section> <option> [<default>]
115 config_get "_tmp
" "$2" "$3"
117 1|on|enabled) export ${NO_EXPORT:+-n} "$1=1";;
118 0|off|disabled) export ${NO_EXPORT:+-n} "$1=0";;
119 *) eval "$1=${4:-0}";;
127 local old_section="$CONFIG_SECTION"
129 CONFIG_SECTION="$section"
130 option "$option" "$value"
131 CONFIG_SECTION="$old_section"
137 local section cfgtype
139 [ -z "$CONFIG_SECTIONS" ] && return 0
140 for section in ${CONFIG_SECTIONS}; do
141 config_get cfgtype "$section" TYPE
142 [ -n "$type" -a "x
$cfgtype" != "x
$type" ] && continue
143 eval "$function \"\
$section\""
148 [ -d /etc/modules.d ] && {
150 sed 's/^[^#]/insmod &/' $* | ash 2>&- || :
157 for file in $(ls $1/*.sh 2>/dev/null); do
163 local PART="$
(grep "\"$1\"" /proc
/mtd |
awk -F: '{print $1}')"
164 local PREFIX=/dev/mtdblock
167 [ -d /dev/mtdblock ] && PREFIX=/dev/mtdblock/
168 echo "${PART:+$PREFIX$PART}"
171 strtok() { # <string> { <variable> [<separator>] ... }
178 while [ $# -gt 1 ]; do
181 [ "$tmp" = "$val" ] && break
185 export ${NO_EXPORT:+-n} "$1=$tmp"; count=$((count+1))
189 if [ $# -gt 0 -a -n "$val" ]; then
190 export ${NO_EXPORT:+-n} "$1=$val"; count=$((count+1))
198 local part="$
(find_mtd_part
"$1")"
200 echo Partition not found.
203 echo -e "\xde\xad\xc0\xde" | mtd -qq write - "$1"
This page took 0.058303 seconds and 5 git commands to generate.