UCI extras

  • This instruction extends UCI functionality.
  • Follow Hotplug extras to extend Hotplug functionality.
  • Follow Opkg extras to extend Opkg functionality.
  • Follow the automated section for quick setup.
  • Validate and compare UCI configurations.
  • Wrap UCI calls to provide a seamless invocation method.
  • Rely on UCI to validate configurations.
  • Rely on diff to identify configuration changes.
UCI sub-command Description
help Show UCI extras
validate [<confs>] Validate UCI configurations
diff <conf_old> [<conf_new>] Compare UCI configurations, requires diffutils
# Configure profile
mkdir -p /etc/profile.d
cat << "EOF" > /etc/profile.d/uci.sh
uci() {
local UCI_CMD="${1}"
if ! type uci_"${UCI_CMD}" &> /dev/null
then command uci "${@}"
else shift
uci_"${UCI_CMD}" "${@}"
uci_help() {
cat << EOI
uci [help|validate|diff]
uci_validate() {
local UCI_CONF
local UCI_CONFS="${@:-/etc/config/*}"
if ! uci show "${UCI_CONF}" > /dev/null
then echo "${UCI_CONF}"
uci_diff() {
local UCI_OCONF="${1:?}"
local UCI_NCONF="${2:-${1}-opkg}"
local UCI_OTCONF="$(mktemp -t uci.XXXXXX)"
local UCI_NTCONF="$(mktemp -t uci.XXXXXX)"
uci export "${UCI_OCONF}" > "${UCI_OTCONF}"
uci export "${UCI_NCONF}" > "${UCI_NTCONF}"
diff -a -b -d -y "${UCI_OTCONF}" "${UCI_NTCONF}"
rm -f "${UCI_OTCONF}" "${UCI_NTCONF}"
. /etc/profile.d/uci.sh
# Validate UCI configurations
uci validate
# Compare UCI configurations
opkg update
opkg install diffutils
opkg newconf
uci diff dhcp
opkg update
opkg install libustream-mbedtls
uclient-fetch -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.More information about cookies
  • Last modified: 2021/04/14 07:37
  • by vgaetera