X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/2bfeaa35643e9c9ae412294c3306a48b71817bb0..9e86b41ee9723d64e544156f1708310e9c023da7:/package/base-files/files/lib/config/uci.sh?ds=sidebyside diff --git a/package/base-files/files/lib/config/uci.sh b/package/base-files/files/lib/config/uci.sh old mode 100755 new mode 100644 index bd1322252..e0293363b --- a/package/base-files/files/lib/config/uci.sh +++ b/package/base-files/files/lib/config/uci.sh @@ -1,8 +1,8 @@ #!/bin/sh # Shell script defining macros for manipulating config files # -# Copyright (C) 2006 by Fokus Fraunhofer -# Copyright (C) 2006 by Felix Fietkau +# Copyright (C) 2006 Fokus Fraunhofer +# Copyright (C) 2006,2007 Felix Fietkau # # 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 @@ -28,16 +28,34 @@ uci_load() { } } +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 +)} + +uci_call_awk() { + local CMD="$*" + awk -f $UCI_ROOT/lib/config/uci.awk -f - < "/tmp/.uci/$PACKAGE_BASE.new" && { mv -f "/tmp/.uci/$PACKAGE_BASE.new" "$CONFIG_FILENAME" && \ rm -f "/tmp/.uci/$PACKAGE_BASE" } ) - lock -u "/tmp/.uci/$PACKAGE_BASE.lock" + $LOCK -u "/tmp/.uci/$PACKAGE_BASE.lock" }