asu icon indicating copy to clipboard operation
asu copied to clipboard

luci-app-attendedsysupgrade/auc: custom uci-defaults support

Open bam80 opened this issue 2 years ago • 10 comments

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

bam80 avatar Sep 16 '23 23:09 bam80

This is not really my area. ._.

mwarning avatar Sep 17 '23 12:09 mwarning

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.

bam80 avatar Sep 17 '23 13:09 bam80

What happens if you simply add that file path to /etc/sysupgrade.conf?

efahl avatar Sep 17 '23 16:09 efahl

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.

bam80 avatar Sep 17 '23 16:09 bam80

And again - it wouldn't help for the firmware reset case which is a main concern.

bam80 avatar Sep 17 '23 17:09 bam80

Add cp /etc/uci-defaults/99-asu-defaults /etc/99-asu-defaults at the end of the /etc/uci-defaults/99-asu-defaults script.

CTCD avatar May 03 '24 05:05 CTCD

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 avatar May 03 '24 05:05 CTCD

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

bam80 avatar May 03 '24 13:05 bam80

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

CTCD avatar May 05 '24 21:05 CTCD