parent
32f2870131
commit
0cf1a58282
@ -1,3 +1,3 @@ |
||||
[ ifup = "$ACTION" ] && { |
||||
uci set "/var/state/network.$INTERFACE.up=1" |
||||
uci_set_state network "$INTERFACE" up 1 |
||||
} |
||||
|
@ -0,0 +1,75 @@ |
||||
#
|
||||
# Copyright (C) 2008 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
include $(TOPDIR)/rules.mk |
||||
|
||||
PKG_NAME:=uci
|
||||
PKG_VERSION:=0.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
|
||||
PKG_MD5SUM:=f6340dce09f5f1552c4e03be98e64265
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk |
||||
|
||||
# set to 1 to enable debugging
|
||||
DEBUG=
|
||||
|
||||
define Package/libuci |
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
DEPENDS:=+libuci
|
||||
TITLE:=C library for the Unified Configuration Interface (UCI)
|
||||
endef |
||||
|
||||
define Package/uci |
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
DEPENDS:=+libuci
|
||||
TITLE:=Utility for the Unified Configuration Interface (UCI)
|
||||
endef |
||||
|
||||
define Package/uci-sh |
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
DEPENDS:=@!PACKAGE_uci
|
||||
TITLE:=Old shell/awk implementation of UCI
|
||||
endef |
||||
|
||||
define Build/Configure |
||||
endef |
||||
|
||||
define Build/Compile |
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
COPTS="$(TARGET_CFLAGS)" \
|
||||
DEBUG="$(DEBUG)" \
|
||||
VERSION="$(PKG_VERSION)" \
|
||||
OS="Linux"
|
||||
endef |
||||
|
||||
define Package/libuci/install |
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libuci.so* $(1)/lib/
|
||||
endef |
||||
|
||||
define Package/uci/install |
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uci $(1)/sbin/
|
||||
$(CP) ./files/uci/* $(1)/
|
||||
endef |
||||
|
||||
define Package/uci-sh/install |
||||
$(INSTALL_DIR) $(1)
|
||||
$(CP) ./files/uci-sh/* $(1)/
|
||||
endef |
||||
|
||||
$(eval $(call BuildPackage,uci)) |
||||
$(eval $(call BuildPackage,libuci)) |
||||
$(eval $(call BuildPackage,uci-sh)) |
@ -0,0 +1,93 @@ |
||||
#!/bin/sh |
||||
# Shell script compatibility wrappers for /sbin/uci |
||||
# |
||||
# Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org> |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 2 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
# General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
|
||||
uci_load() { |
||||
local PACKAGE="$1" |
||||
|
||||
_C=0 |
||||
export ${NO_EXPORT:+-n} CONFIG_SECTIONS= |
||||
export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=0 |
||||
export ${NO_EXPORT:+-n} CONFIG_SECTION= |
||||
|
||||
eval "$(/sbin/uci ${LOAD_STATE:+-P /var/state} -S -n export "$PACKAGE")" |
||||
|
||||
${CONFIG_SECTION:+config_cb} |
||||
} |
||||
|
||||
uci_set_default() { |
||||
local PACKAGE="$1" |
||||
/sbin/uci -q show "$1" > /dev/null && return 0 |
||||
/sbin/uci import "$1" |
||||
} |
||||
|
||||
uci_revert_state() { |
||||
local PACKAGE="$1" |
||||
local CONFIG="$2" |
||||
local OPTION="$3" |
||||
|
||||
/bin/uci -P /var/state revert "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}" |
||||
} |
||||
|
||||
uci_set_state() { |
||||
local PACKAGE="$1" |
||||
local CONFIG="$2" |
||||
local OPTION="$3" |
||||
local VALUE="$4" |
||||
|
||||
[ -z "$VALUE" ] && return 0 |
||||
/sbin/uci -P /var/state set "$PACKAGE.$CONFIG${OPTION:+.$OPTION}=$VALUE" |
||||
} |
||||
|
||||
uci_set() { |
||||
local PACKAGE="$1" |
||||
local CONFIG="$2" |
||||
local OPTION="$3" |
||||
local VALUE="$4" |
||||
|
||||
/sbin/uci set "$PACKAGE.$CONFIG.$OPTION=$TYPE" |
||||
} |
||||
|
||||
uci_add() { |
||||
local PACKAGE="$1" |
||||
local TYPE="$2" |
||||
local CONFIG="$3" |
||||
|
||||
/sbin/uci set "$PACKAGE.$CONFIG=$TYPE" |
||||
} |
||||
|
||||
uci_rename() { |
||||
local PACKAGE="$1" |
||||
local CONFIG="$2" |
||||
local VALUE="$3" |
||||
|
||||
/sbin/uci rename "$PACKAGE.$CONFIG=$VALUE" |
||||
} |
||||
|
||||
uci_remove() { |
||||
local PACKAGE="$1" |
||||
local CONFIG="$2" |
||||
local OPTION="$3" |
||||
|
||||
/sbin/uci del "$PACKAGE.$CONFIG${OPTION:+.$OPTION}" |
||||
} |
||||
|
||||
uci_commit() { |
||||
local PACKAGE="$1" |
||||
/sbin/uci commit $PACKAGE |
||||
} |
Loading…
Reference in new issue