summaryrefslogtreecommitdiff
path: root/package/base-files/files/etc
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-02-03 06:48:15 +0000
committerFelix Fietkau <nbd@openwrt.org>2008-02-03 06:48:15 +0000
commit0cf1a58282bacda7552d294e0f99562ece74cf22 (patch)
treef1c533f73a26f5da018025fae277a27c84ecdfc0 /package/base-files/files/etc
parent32f2870131750e44e5a73f6255f077cddca2bca1 (diff)
downloadmtk-20170518-0cf1a58282bacda7552d294e0f99562ece74cf22.zip
mtk-20170518-0cf1a58282bacda7552d294e0f99562ece74cf22.tar.gz
mtk-20170518-0cf1a58282bacda7552d294e0f99562ece74cf22.tar.bz2
Here comes the new UCI. Enjoy :)
SVN-Revision: 10367
Diffstat (limited to 'package/base-files/files/etc')
-rwxr-xr-xpackage/base-files/files/etc/functions.sh58
-rw-r--r--package/base-files/files/etc/hotplug.d/iface/00-netstate2
-rw-r--r--package/base-files/files/etc/hotplug.d/iface/10-routes1
-rwxr-xr-xpackage/base-files/files/etc/init.d/boot2
4 files changed, 25 insertions, 38 deletions
diff --git a/package/base-files/files/etc/functions.sh b/package/base-files/files/etc/functions.sh
index ef28015..5ad45ec 100755
--- a/package/base-files/files/etc/functions.sh
+++ b/package/base-files/files/etc/functions.sh
@@ -10,6 +10,7 @@ N="
_C=0
NO_EXPORT=1
+LOAD_STATE=1
hotplug_dev() {
env -i ACTION=$1 INTERFACE=$2 /sbin/hotplug-call net
@@ -23,12 +24,21 @@ append() {
eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\""
}
+config_load() {
+ [ -n "$IPKG_INSTROOT" ] && return 0
+ uci_load "$@"
+}
+
reset_cb() {
config_cb() { return 0; }
option_cb() { return 0; }
}
reset_cb
+package() {
+ return 0
+}
+
config () {
local cfgtype="$1"
local name="$2"
@@ -84,37 +94,6 @@ config_clear() {
done
}
-config_load() {
- local cfg
- local uci
- local PACKAGE="$1"
-
- case "$PACKAGE" in
- /*) cfg="$PACKAGE"
- uci=""
- ;;
- *) cfg="$UCI_ROOT/etc/config/$PACKAGE"
- uci="/tmp/.uci/${PACKAGE}"
- ;;
- esac
-
- [ -e "$cfg" ] || cfg=""
- [ -e "$uci" ] || uci=""
-
- # no config
- [ -z "$cfg" -a -z "$uci" ] && return 1
-
- _C=0
- export ${NO_EXPORT:+-n} CONFIG_SECTIONS=
- export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=0
- export ${NO_EXPORT:+-n} CONFIG_SECTION=
-
- ${cfg:+. "$cfg"}
- ${uci:+. "$uci"}
-
- ${CONFIG_SECTION:+config_cb}
-}
-
config_get() {
case "$3" in
"") eval "echo \"\${CONFIG_${1}_${2}}\"";;
@@ -218,8 +197,15 @@ jffs2_mark_erase() {
echo -e "\xde\xad\xc0\xde" | mtd -qq write - "$1"
}
-uci_set_default() {
- local PACKAGE="$1"
- [ -e "/etc/config/$1" ] && return 0
- cat > "/etc/config/$1"
-}
+uci_apply_defaults() {(
+ cd /etc/uci-defaults || return 0
+ files="$(ls)"
+ [ -z "$files" ] && return 0
+ mkdir -p /tmp/.uci
+ for file in $files; do
+ ( . "./$(basename $file)" ) && rm -f "$file"
+ done
+ uci commit
+)}
+
+[ -z "$IPKG_INSTROOT" ] && . /lib/config/uci.sh
diff --git a/package/base-files/files/etc/hotplug.d/iface/00-netstate b/package/base-files/files/etc/hotplug.d/iface/00-netstate
index 6bf6214..f215d29 100644
--- a/package/base-files/files/etc/hotplug.d/iface/00-netstate
+++ b/package/base-files/files/etc/hotplug.d/iface/00-netstate
@@ -1,3 +1,3 @@
[ ifup = "$ACTION" ] && {
- uci set "/var/state/network.$INTERFACE.up=1"
+ uci_set_state network "$INTERFACE" up 1
}
diff --git a/package/base-files/files/etc/hotplug.d/iface/10-routes b/package/base-files/files/etc/hotplug.d/iface/10-routes
index 7e957f7..963728f 100644
--- a/package/base-files/files/etc/hotplug.d/iface/10-routes
+++ b/package/base-files/files/etc/hotplug.d/iface/10-routes
@@ -63,7 +63,6 @@ case "$ACTION" in
ifup)
include /lib/network
scan_interfaces
- . /var/state/network
config_foreach "add_route" route
config_foreach "add_route6" route6
;;
diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot
index b524c39..0b77447 100755
--- a/package/base-files/files/etc/init.d/boot
+++ b/package/base-files/files/etc/init.d/boot
@@ -36,6 +36,8 @@ start() {
mkdir -p /var/log
mkdir -p /var/lock
mkdir -p /var/state
+ mkdir -p /tmp/.uci
+ chown 0700 /tmp/.uci
touch /var/log/wtmp
touch /var/log/lastlog
ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf