You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# HACK: there seem no better way to clear out a list
If you rely solely on uci batch commands, it's not possible to do. If you make use of some form of on-device scripting, it's trivial, and this is what both OpenWRT's documentation and scripts do currently. For example, deleting all existing network devices with ash:
while uci -q del network.@device[-1] 2>/dev/null;do:;done
There shouldn't really be much of an issue interspersing uci batch commands and segments of shell script; so long as you don't uci commit the changes until everything is done, any failure in the script won't be persisted and could be trivially reverted.
As a possibly more interesting alternative, ucode is now on every OpenWRT image from 22.03 and on, so you could directly ship the uci.json onto the router, along with a ucode script to parse & act on it directly on the target.
The text was updated successfully, but these errors were encountered:
Shados
changed the title
Deleting array-like config sections
Deleting array-like openwrt uci config sections
Jul 20, 2023
dotfiles/openwrt/nix_uci/__init__.py
Line 109 in 05c0dbc
If you rely solely on uci batch commands, it's not possible to do. If you make use of some form of on-device scripting, it's trivial, and this is what both OpenWRT's documentation and scripts do currently. For example, deleting all existing network devices with
ash
:There shouldn't really be much of an issue interspersing uci batch commands and segments of shell script; so long as you don't
uci commit
the changes until everything is done, any failure in the script won't be persisted and could be trivially reverted.As a possibly more interesting alternative, ucode is now on every OpenWRT image from 22.03 and on, so you could directly ship the
uci.json
onto the router, along with aucode
script to parse & act on it directly on the target.The text was updated successfully, but these errors were encountered: