local var="$1"
local value="$2"
local sep="${3:- }"
-
+
eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\""
}
config () {
local cfgtype="$1"
local name="$2"
-
+
export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$(($CONFIG_NUM_SECTIONS + 1))
name="${name:-cfg$CONFIG_NUM_SECTIONS}"
append CONFIG_SECTIONS "$name"
local NEW="$2"
local oldvar
local newvar
-
+
[ -n "$OLD" -a -n "$NEW" ] || return
for oldvar in `set | grep ^CONFIG_${OLD}_ | \
sed -e 's/\(.*\)=.*$/\1/'` ; do
unset "$oldvar"
done
export ${NO_EXPORT:+-n} CONFIG_SECTIONS="$(echo " $CONFIG_SECTIONS " | sed -e "s, $OLD , $NEW ,")"
-
+
[ "$CONFIG_SECTION" = "$OLD" ] && export ${NO_EXPORT:+-n} CONFIG_SECTION="$NEW"
}
export ${NO_EXPORT:+-n} CONFIG_SECTIONS="${SECTION:+$CONFIG_SECTIONS}"
for oldvar in `set | grep ^CONFIG_${SECTION:+${SECTION}_} | \
- sed -e 's/\(.*\)=.*$/\1/'` ; do
- unset $oldvar
+ sed -e 's/\(.*\)=.*$/\1/'` ; do
+ unset $oldvar
done
}
local type="$1"
[ "$#" -ge 1 ] && shift
local section cfgtype
-
+
[ -z "$CONFIG_SECTIONS" ] && return 0
for section in ${CONFIG_SECTIONS}; do
config_get cfgtype "$section" TYPE
include() {
local file
-
+
for file in $(ls $1/*.sh 2>/dev/null); do
. $file
done
find_mtd_part() {
local PART="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')"
local PREFIX=/dev/mtdblock
-
+
PART="${PART##mtd}"
[ -d /dev/mtdblock ] && PREFIX=/dev/mtdblock/
echo "${PART:+$PREFIX$PART}"
service_kill() {
cat 1>&2 << __END_OF_WARNING__
#
-# WARNING: the 'service_kill' function is now deprecated and might be
+# WARNING: the 'service_kill' function is now deprecated and might be
# removed soon. Consider using the other new service_* wrappers instead.
#
__END_OF_WARNING__