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
28 if [ -z "$CONFIG_APPEND" ]; then
29 export ${NO_EXPORT:+-n} CONFIG_SECTIONS
=
30 export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS
=0
31 export ${NO_EXPORT:+-n} CONFIG_SECTION
=
34 DATA
="$(/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} ${LOAD_STATE:+-P /var/state} -S -n export "$PACKAGE" 2>/dev/null)"
36 [ "$RET" != 0 -o -z "$DATA" ] ||
eval "$DATA"
39 ${CONFIG_SECTION:+config_cb}
45 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show
"$PACKAGE" > /dev
/null
&& return 0
46 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} import
"$PACKAGE"
47 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
"$PACKAGE"
55 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -P /var/state revert "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
64 [ "$#" = 4 ] || return 0
65 /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -P /var/state set "$PACKAGE.
$CONFIG${OPTION:+.$OPTION}=$VALUE"
74 /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.
$CONFIG.
$OPTION=$VALUE"
78 uci_get "$1" "$2" "$3" "$4" "/var
/state
"
88 /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} ${STATE:+-P $STATE} -q get "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
90 [ "$RET" -ne 0 ] && [ -n "$DEFAULT" ] && echo "$DEFAULT"
99 if [ -z "$CONFIG" ]; then
100 export ${NO_EXPORT:+-n} CONFIG_SECTION
="$(/sbin/uci add "$PACKAGE" "$TYPE")"
102 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.$CONFIG=$TYPE"
103 export ${NO_EXPORT:+-n} CONFIG_SECTION
="$CONFIG"
112 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} rename
"$PACKAGE.$CONFIG=$VALUE"
120 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} del
"$PACKAGE.$CONFIG${OPTION:+.$OPTION}"
125 /sbin
/uci
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
$PACKAGE
This page took 0.047849 seconds and 5 git commands to generate.