all: make router setup/cleanup works more generally

This commit is contained in:
Cuong Manh Le
2023-08-09 23:54:23 +07:00
committed by Cuong Manh Le
parent 66cb7cc21d
commit 9ed8e49a08
13 changed files with 115 additions and 34 deletions
+6
View File
@@ -53,6 +53,9 @@ func (f *FreshTomato) PreRun() error {
}
func (f *FreshTomato) Setup() error {
if f.cfg.FirstListener().IsDirectDnsListener() {
return nil
}
// Already setup.
if val, _ := nvram.Run("get", nvram.CtrldSetupKey); val == "1" {
return nil
@@ -83,6 +86,9 @@ func (f *FreshTomato) Setup() error {
}
func (f *FreshTomato) Cleanup() error {
if f.cfg.FirstListener().IsDirectDnsListener() {
return nil
}
if val, _ := nvram.Run("get", nvram.CtrldSetupKey); val == "1" {
nvramKvMap["dnsmasq_custom"] = ""
// Restore old configs.