添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Hi All
Thank you for all the help so far with all the topics available.
i have been learning a lot with this forum... but I have reached a point where i can't find a solution:

I would like to know if there is a way to "change" the way the "RESET" button works on OpenWRT.
Please allow me to (try) explain my intention really quick:
I have a VirtualHere cloudhub ( https://www.virtualhere.com/hardware )
(Essentially this is a custom build that runs in a couple of different portable routers and allow for USB sharing over wifi.)

After having this router for a while (and with the help of Michael, the VirtualHere developer) i changed a couple of settings to fit my needs (mainly static IP addresses) and added a GUI (luci)
Everything works perfectly and as i want.
A couple of day ago i tried to reset it (pressing the reset button) in the hope that the GUI and some setting were still available... they were not.

So my question is, what do i need to do to change the reset behavior?
Any code i need to add to a file in order to press the Reset Button and have it reset to the setting i want (instead of the factory default)
Essentially i would like to press the button and reset it to a specific point (not factory)

Thank you for your time

Hope you have a great day

PS: please keep in mind i have no programming background.
All the changed i did (fron changing IPs and installing Luci) was done by browsing the internet testing different ways to do it, all done with SSH... so my knowhow is limited.

Thank you

"hotplug" scripts for the buttons.

As an example, from my Archer C7 v2:

jeff@office:~$ cat /etc/rc.button/reset 
#!/bin/sh
. /lib/functions.sh
OVERLAY="$( grep ' /overlay ' /proc/mounts )"
case "$ACTION" in
pressed)
	[ -z "$OVERLAY" ] && return 0
	return 5
timeout)
	. /etc/diag.sh
	set_state failsafe
released)
	if [ "$SEEN" -lt 1 ]
		echo "REBOOT" > /dev/console
		reboot
	elif [ "$SEEN" -ge 5 -a -n "$OVERLAY" ]
		echo "FACTORY RESET" > /dev/console
		jffs2reset -y && reboot &
return 0
Thank you for your reply
Do you mind helping me a bit more?
The above is exactly what i have in my /etc/rc.button/reset at the moment and this resets the router to factory OpenWrt.

I do not know how to change this.

Also not sure if i correctly explained what i want to do:
Step 1- I installed the modified OpenWrt version (but this version does not have Luci by default)
Step 2- I installed Luci after testing the router is working fine.
Step 3- At this point, if i press the reset button i will lose Luci and all configurations i made.

How can i "change" the reset action to go back to Step 2 instead of all the way back to factory(step1)

Thank you

If you're building your own you can put custom config and other files in the base image. Doing a factory reset will revert to those files.

"Factory reset" merely reformats the jffs overlay partition, which removes ALL new or changed files that are not in the read-only rootfs. If you want to pick and choose what is saved, you will need a completely new approach that is more complicated than just wiping the whole filesystem.

It sounds like you want to change what is left after a reset, rather than make the reset button do "something different". As mk24 points out, reset erases the overlay partition completely. When you install packages, they are installed on the overlay partition, along with all of your config. LuCI is not part of the ROM for "snapshot" images (but is for "release" images). If preserving packages is your goal (and wiping all config), one straightforward way to do that is to build a custom image that contains the packages you desire. I use the build system to do this. There also is an "image builder" that is a little easier to set up, but for the work involved, I prefer the flexibility of the full build system.

If you want to wipe only some things on a reset, then you likely need some fancy scripting. Another way to occasionally "reset" some things would be to boot into failsafe mode and remove/change the files you want.

Hi MK24 / Jeff

I understand now.
I think i will try to have a chat with the VirtualHere developer and see if he is willing to add Luci to the next update. meaning that after the update, the factory restore would still include a GUI.

I will not try to build my own system as i have no experience with programming of C or any language used here.
(may be a good time to learn.... its never too late, even if you are 35yo) hahahaha

Have a fantastic day

Thank you so much for your help.
Really appreciated.

LuCI is installed by default for the release builds. So unless you (or your developer) are installing from snapshots and/or building your own images, a reset should not cause LuCI to be deleted. The others have stated that you can build an image with your desired default configuration in terms of installed packages and configuration parameters.

But, unless there are reasons that you are not happy with the release builds (such as inappropriate default configs, need to add or remove specific packages, etc.), it is often easiest to simply use the official release builds and go from there.

Another thing you can do is to pull a backup of your system configuration when it is in a good/known-working/desired state. While this won't preserve additional installed packages, it will save all configuration files that reside in the standard locations (including those used by most packages installed separately), and it also allows you to specify other files and/or directories that should be included in the backup. This way you can easily reset your router back to the defaults (either the standard OpenWrt defaults or your own custom defaults included in a custom image) and then a quick restore from the backup file will bring you back to your desired running configuration.

As far as building your own system images and such -- it's not all that hard to learn and might even be fun. I'd recommend picking up an inexpensive router (new or 2nd hand) to use as an experimental device so that you have a 'sandbox' that will not involve possibly messing up your production router.

I used the reset button as WPS+Factory by editing the dts file and "hotplug" scripts for the button (/etc/rc.button/)

wpsfactory2705×560 46.7 KB