-
Notifications
You must be signed in to change notification settings - Fork 37
Description
dotfiles/openwrt/nix_uci/__init__.py
Line 109 in 05c0dbc
| # 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 :; doneThere 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.