X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/3e5a9940c628c70677b7dd230ffe8016d0bfaef0..b7d3d9d3cef2286b7266dc447265a0a21565b9b9:/package/base-files/files/etc/functions.sh diff --git a/package/base-files/files/etc/functions.sh b/package/base-files/files/etc/functions.sh index 0314692c5..e4b3badb4 100755 --- a/package/base-files/files/etc/functions.sh +++ b/package/base-files/files/etc/functions.sh @@ -2,7 +2,13 @@ # Copyright (C) 2006 OpenWrt.org # Copyright (C) 2006 Fokus Fraunhofer -alias debug=${DEBUG:-:} + +debug () { + ${DEBUG:-:} "$@" +} +mount() { + busybox mount "$@" +} # newline N=" @@ -11,6 +17,7 @@ N=" _C=0 NO_EXPORT=1 LOAD_STATE=1 +LIST_SEP=" " hotplug_dev() { env -i ACTION=$1 INTERFACE=$2 /sbin/hotplug-call net @@ -56,6 +63,7 @@ config_load() { reset_cb() { config_cb() { return 0; } option_cb() { return 0; } + list_cb() { return 0; } } reset_cb @@ -78,11 +86,25 @@ config () { option () { local varname="$1"; shift local value="$*" - + export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_${varname}=$value" [ -n "$NO_CALLBACK" ] || option_cb "$varname" "$*" } +list() { + local varname="$1"; shift + local value="$*" + local len + + config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0 + [ $len = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}" + len=$(($len + 1)) + config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value" + config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len" + append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP" + list_cb "$varname" "$*" +} + config_rename() { local OLD="$1" local NEW="$2" @@ -118,22 +140,25 @@ config_clear() { done } +# config_get