Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting array-like openwrt uci config sections #738

Open
Shados opened this issue Jul 20, 2023 · 1 comment
Open

Deleting array-like openwrt uci config sections #738

Shados opened this issue Jul 20, 2023 · 1 comment

Comments

@Shados
Copy link

Shados commented Jul 20, 2023

# 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.

@Shados Shados changed the title Deleting array-like config sections Deleting array-like openwrt uci config sections Jul 20, 2023
@Mic92
Copy link
Owner

Mic92 commented Aug 28, 2023

ucode sounds nice. Thank you. I check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants