This article relies on the following:
Підкоманда Опис
validate [<конфіг>] Перевірити UCI конфігурації.
diff <стара> [<нова>] Порівняти UCI конфігурації. Потребує diffutils .
# Налаштування профілю
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
# Встановити необхідні пакети
opkg update
opkg install diffutils
# Перевірити UCI конфігурації
uci validate
# Порівняти UCI конфігурації
opkg newconf
uci diff dhcp
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.
OK More information about cookies