How do not erase installed packades after factory reset?


For some remote offices I use next equipment:

Firmware Version:	OpenWrt 18.06.2 r7676-cddd7b4c77 / LuCI openwrt-18.06 branch (git-19.020.41695-6f6641d)
Router:             TP-Link TL-WR842N v5
USB modem:          Huawei E3372h-153  (Hi-Link mode)

As a result of inexperienced user actions, or power surge, the router returns to factory settings.
In the remote office there is no other source of the Internet, only USB modem, and this is problem.
Before upload backup config, I need to install some packages:

opkg update
#For connect USB modem
opkg install kmod-usb-net-cdc-ether
opkg install usb-modeswitch
opkg install luci-proto-3g
#For setup openvpn client
opkg install openvpn-openssl
opkg install luci-app-openvpn
#For upload openvpn certificates via ssh 
opkg install  openssh-sftp-server

But at this moment in time, the USB modem is not working yet, there is no internet on the router.
If at that moment in time, the modem would work, users would be able to provide me with a remote access, for example, through Teamveawer. And I did a upload of the configuration file.
In this situation, I need to submit the Internet to the router, install the required packages, upload the configuration backup, but the user by phone is unlikely to be able to do all this.

What have i done:

Disable the RESET button (comment "#jffs2reset -y && reboot &" in file /etc/rc.button/reset )

But I thunk, I must go further and:

  1. Integrate installed packages into firmware. I need to reset factory defaults to not remove installed packages. How do this ?
  2. Integrate configuration into firmaware. How do this ?

The imagebuilder is the answer to both 1. and 2, they are configured in the PACKAGES and FILES variables.


Can be done with the image builder or with the full build system. For the full build system, the contents of ./files/ gets copied into the ROM relative to the root file system.

1 Like

Thank you for link .