@@ -79,65 +79,6 @@ o = s:taboption("basic", Flag, "waitonboot", translate("Restart when the network
7979o .default = 1
8080o .optional = false
8181
82- -- upgrade protect
83- o = s :taboption (" basic" , DynamicList , " upprotect" , translate (" Keep files when system upgrade" ))
84- o :value (" $binpath" ,translate (" core executable" ))
85- o :value (" $configpath" ,translate (" config file" ))
86- o :value (" $logfile" ,translate (" log file" ))
87- o :value (" $workdir/data/filters" ," filters" )
88- o :value (" $workdir/data/stats.db" ," stats.db" )
89- o :value (" $workdir/data/querylog.json" ," querylog.json" )
90- o :value (" $workdir/data/sessions.db" ," sessions.db" )
91- o .default = nil
92- o .optional = false
93-
94- -- backup workdir on shutdown
95- local workdir = uci :get (" AdGuardHome" ," AdGuardHome" ," workdir" ) or " /usr/bin/AdGuardHome"
96- o = s :taboption (" basic" , MultiValue , " backupfile" , translate (" Backup workdir files when shutdown" ))
97- o1 = s :taboption (" basic" , Value , " backupwdpath" , translate (" Backup workdir path" ))
98- local name
99- o :value (" filters" ," filters" )
100- o :value (" stats.db" ," stats.db" )
101- o :value (" querylog.json" ," querylog.json" )
102- o :value (" sessions.db" ," sessions.db" )
103- o1 :depends (" backupfile" , " filters" )
104- o1 :depends (" backupfile" , " stats.db" )
105- o1 :depends (" backupfile" , " querylog.json" )
106- o1 :depends (" backupfile" , " sessions.db" )
107- for name in fs .glob (workdir .. " /data/*" )
108- do
109- name = fs .basename (name )
110- if name ~= " filters" and name ~= " stats.db" and name ~= " querylog.json" and name ~= " sessions.db" then
111- o :value (name ,name )
112- o1 :depends (" backupfile" , name )
113- end
114- end
115- o .widget = " checkbox"
116- o .default = nil
117- o .optional = false
118- o .description = translate (" Will be restore when workdir/data is empty" )
119-
120- -- backup workdir path
121-
122- o1 .default = " /usr/bin/AdGuardHome"
123- o1 .datatype = " string"
124- o1 .optional = false
125- o1 .validate = function (self , value )
126- if fs .stat (value ," type" )== " reg" then
127- if m .message then
128- m .message = m .message .. " \n error!backup dir is a file"
129- else
130- m .message = " error!backup dir is a file"
131- end
132- return nil
133- end
134- if string.sub (value ,- 1 )== " /" then
135- return string.sub (value , 1 , - 2 )
136- else
137- return value
138- end
139- end
140-
14182---- Core Settings ----
14283s :tab (" core" , translate (" Core Settings" ))
14384
@@ -269,6 +210,68 @@ o.default = [[https://static.adguard.com/adguardhome/release/AdGuardHome_linux_$
269210#https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_${Arch}.tar.gz
270211https://github.com/AdguardTeam/AdGuardHome/releases/download/${latest_ver}/AdGuardHome_linux_${Arch}.tar.gz]]
271212
213+ ---- Backup Settings ----
214+ s :tab (" backup" , translate (" Backup Settings" ))
215+
216+ -- upgrade protect
217+ o = s :taboption (" backup" , DynamicList , " upprotect" , translate (" Keep files when system upgrade" ))
218+ o :value (" $binpath" ,translate (" core executable" ))
219+ o :value (" $configpath" ,translate (" config file" ))
220+ o :value (" $logfile" ,translate (" log file" ))
221+ o :value (" $workdir/data/filters" ," filters" )
222+ o :value (" $workdir/data/stats.db" ," stats.db" )
223+ o :value (" $workdir/data/querylog.json" ," querylog.json" )
224+ o :value (" $workdir/data/sessions.db" ," sessions.db" )
225+ o .default = nil
226+ o .optional = false
227+
228+ -- backup workdir on shutdown
229+ local workdir = uci :get (" AdGuardHome" ," AdGuardHome" ," workdir" ) or " /usr/bin/AdGuardHome"
230+ o = s :taboption (" backup" , MultiValue , " backupfile" , translate (" Backup workdir files when shutdown" ))
231+ o1 = s :taboption (" backup" , Value , " backupwdpath" , translate (" Backup workdir path" ))
232+ local name
233+ o :value (" filters" ," filters" )
234+ o :value (" stats.db" ," stats.db" )
235+ o :value (" querylog.json" ," querylog.json" )
236+ o :value (" sessions.db" ," sessions.db" )
237+ o1 :depends (" backupfile" , " filters" )
238+ o1 :depends (" backupfile" , " stats.db" )
239+ o1 :depends (" backupfile" , " querylog.json" )
240+ o1 :depends (" backupfile" , " sessions.db" )
241+ for name in fs .glob (workdir .. " /data/*" )
242+ do
243+ name = fs .basename (name )
244+ if name ~= " filters" and name ~= " stats.db" and name ~= " querylog.json" and name ~= " sessions.db" then
245+ o :value (name ,name )
246+ o1 :depends (" backupfile" , name )
247+ end
248+ end
249+ o .widget = " checkbox"
250+ o .default = nil
251+ o .optional = false
252+ o .description = translate (" Will be restore when workdir/data is empty" )
253+
254+ -- backup workdir path
255+
256+ o1 .default = " /usr/bin/AdGuardHome"
257+ o1 .datatype = " string"
258+ o1 .optional = false
259+ o1 .validate = function (self , value )
260+ if fs .stat (value ," type" )== " reg" then
261+ if m .message then
262+ m .message = m .message .. " \n error!backup dir is a file"
263+ else
264+ m .message = " error!backup dir is a file"
265+ end
266+ return nil
267+ end
268+ if string.sub (value ,- 1 )== " /" then
269+ return string.sub (value , 1 , - 2 )
270+ else
271+ return value
272+ end
273+ end
274+
272275---- Crontab Settings ----
273276s :tab (" crontab" , translate (" Crontab Settings" ))
274277
0 commit comments