Show pagesourceOld revisionsBacklinksBack to top × Table of Contents UCI extras Introduction Features Implementation Commands Instructions Examples Automated UCI extras This article relies on the following: Accessing web interface / command-line interface Managing configs / packages / services / logs Introduction This instruction extends the functionality of UCI. Follow the automated section for quick setup. Features Validate and compare UCI configurations. Implementation Wrap UCI calls to provide a seamless invocation method. Rely on UCI to validate configurations. Rely on diff to identify configuration changes. Commands Sub-command Description validate [<confs>] Validate UCI configurations. diff <oldconf> [<newconf>] Compare UCI configurations, requires diffutils. Instructions # Configure profile mkdir -p /etc/profile.d cat << "EOF" > /etc/profile.d/uci.sh uci() { local UCI_CMD="${1}" case "${UCI_CMD}" in (validate|diff) uci_"${@}" ;; (*) command uci "${@}" ;; esac } uci_validate() { local UCI_CONF="${@:-/etc/config/*}" for UCI_CONF in ${UCI_CONF} do if ! uci show "${UCI_CONF}" > /dev/null then echo "${UCI_CONF}" fi done } uci_diff() { local UCI_OCONF="${1:?}" local UCI_NCONF="${2:-${1}-opkg}" local UCI_OTEMP="$(mktemp -t uci.XXXXXX)" local UCI_NTEMP="$(mktemp -t uci.XXXXXX)" uci export "${UCI_OCONF}" > "${UCI_OTEMP}" uci export "${UCI_NCONF}" > "${UCI_NTEMP}" diff -a -b -d -y "${UCI_OTEMP}" "${UCI_NTEMP}" rm -f "${UCI_OTEMP}" "${UCI_NTEMP}" } EOF . /etc/profile.d/uci.sh Examples # Install packages opkg update opkg install diffutils # Validate UCI configurations uci validate # Compare UCI configurations opkg newconf uci diff dhcp Automated wget -U "" -O uci-extras.sh "https://openwrt.org/_export/code/docs/guide-user/advanced/uci_extras?codeblock=0" . ./uci-extras.sh This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.OKMore information about cookies Last modified: 2023/09/18 20:00by vgaetera