luci-app-attendedsysupgrade/auc: custom uci-defaults support
uci-defaults scripts are essential for accessing device after firmware reset.
If user defined a custom UCI-Defaults script with OpenWrt Firmware Selector, it's feasible to preserve it upon firmware upgrade, at least optionally, and include it to new image. Otherwise, access to the device can be lost next time user performs firmware Reset.
As a simple approach to solve this, luci-app-attendedsysupgrade/auc utilities could check if /rom/etc/uci-defaults/99-asu-defaults file exists in current firmware,
https://github.com/openwrt/asu/blob/3ef4757b9fcc401b3d18ebb6954276b0210f07fb/asu/build.py#L202
and if so, include it to a new image using "defaults" BuildRequest member:
https://sysupgrade.openwrt.org/ui/
{
defaults string Custom shell script embedded in firmware image to be run on first boot.
@aparcar @mwarning @dangowrt
This is not really my area. ._.
Please let me know if I need to report it separately for luci-app-attendedsysupgrade/auc utils. Also, I would like to know if you agree with the idea overall.
What happens if you simply add that file path to /etc/sysupgrade.conf?
What path do you mean? If it's in /rom, I doubt sysupgrade can handle it because it's r/o. If you mean /etc/uci-defaults/, there are no more files there already because they are wiped on first boot.
And again - it wouldn't help for the firmware reset case which is a main concern.
Add cp /etc/uci-defaults/99-asu-defaults /etc/99-asu-defaults at the end of the /etc/uci-defaults/99-asu-defaults script.
Add an input box in ASU's advanced mode (similar to Firmware Selector Web).
The content of the input box is /etc/99-asu-defaults.
@CTCD
And again - it wouldn't help for the firmware reset case which is a main concern.
~~I mean full reset here, when rw partition is formatted (I'm not sure about the one triggered from LuCI, it works differently).~~
~~The workaround you suggested might be reasonable for other cases, though.~~
Oh, it won't work for the reset case, of course - reset wipes the configuration.
This script is for upgrading OpenWrt firmware and supports preserving user configuration and installed packages after resetting the device:
wget -O /etc/99-asu-defaults "https://raw.githubusercontent.com/CTCD/99-asu-defaults/main/99-asu-defaults" && sed -n '/Install upasu/,$p' /etc/99-asu-defaults | sh