I need to get a mac address in the uci-defaults script and I've tried: . /usr/share/libubox/jshn.sh; json_load "$(/bin/ubus call network.device status)";
but I get a command failed message, even tho json_load "$(/bin/ubus call system board)";
works just fine.
So for now I ended up just screen scraping ifconfig, but I'm wondering if there's a better option?
The uci-defaults script runs before netifd is started, so you cannot query the ubus network namespace at this point in time. If you know the device name you can use cat /sys/class/net/$dev/address which is somewhat cleaner than screen scraping ifconfig.