2 # Shell script compatibility wrappers for /sbin/uci
4 # Copyright (C) 2008-2010 OpenWrt.org
5 # Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 if [ -z "$CONFIG_APPEND" ]; then
30 for VAR
in $CONFIG_LIST_STATE; do
31 export ${NO_EXPORT:+-n} CONFIG_
${VAR}=
32 export ${NO_EXPORT:+-n} CONFIG_
${VAR}_LENGTH
=
34 export ${NO_EXPORT:+-n} CONFIG_LIST_STATE
=
35 export ${NO_EXPORT:+-n} CONFIG_SECTIONS
=
36 export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS
=0
37 export ${NO_EXPORT:+-n} CONFIG_SECTION
=
40 DATA
="$(/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} ${LOAD_STATE:+-P /var/state} -S -n export "$PACKAGE" 2>/dev/null)"
42 [ "$RET" != 0 -o -z "$DATA" ] ||
eval "$DATA"
45 ${CONFIG_SECTION:+config_cb}
51 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show
"$PACKAGE" > /dev
/null
&& return 0
52 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} import
"$PACKAGE"
53 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
"$PACKAGE"
61 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -P /var/state revert "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
70 [ "$#" = 4 ] || return 0
71 /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -P /var/state set "$PACKAGE.
$CONFIG${OPTION:+.$OPTION}=$VALUE"
80 /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.
$CONFIG.
$OPTION=$VALUE"
84 uci_get "$1" "$2" "$3" "$4" "/var
/state
"
94 /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} ${STATE:+-P $STATE} -q get "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
96 [ "$RET" -ne 0 ] && [ -n "$DEFAULT" ] && echo "$DEFAULT"
105 if [ -z "$CONFIG" ]; then
106 export ${NO_EXPORT:+-n} CONFIG_SECTION
="$(/sbin/uci add "$PACKAGE" "$TYPE")"
108 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.$CONFIG=$TYPE"
109 export ${NO_EXPORT:+-n} CONFIG_SECTION
="$CONFIG"
118 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} rename
"$PACKAGE.$CONFIG=$VALUE"
126 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} del
"$PACKAGE.$CONFIG${OPTION:+.$OPTION}"
131 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
$PACKAGE
This page took 0.052852 seconds and 5 git commands to generate.