@@ -154,34 +154,33 @@ if lfs.attributes(remote_config_dir, 'mode') == 'directory' then
154154 -- if there's no backup of the file yet, create one
155155 if not utils .file_exists (stored_path ) then
156156 os.execute (' cp ' .. standard_path .. ' ' .. stored_path )
157- if utils .file_exists (remote_path ) then
158- for key , section in pairs (stored :get_all (file )) do
159- -- check if section is in remote configuration
160- local section_check = check :get (file , section [' .name' ])
161- if section_check then
162- -- check if options is in remote configuration
163- for option , value in pairs (section ) do
164- if not utils .starts_with_dot (option ) then
165- local option_check = check :get (file , section [' .name' ], option )
166- if option_check then
167- -- if option is in remote configuration, remove it
168- stored :delete (file , section [' .name' ], option )
169- end
157+
158+ for _ , section in pairs (stored :get_all (file )) do
159+ -- check if section is in remote configuration
160+ local section_check = check :get (file , section [' .name' ])
161+ if section_check then
162+ -- check if options is in remote configuration
163+ for option , value in pairs (section ) do
164+ if not utils .starts_with_dot (option ) then
165+ local option_check = check :get (file , section [' .name' ], option )
166+ if option_check then
167+ -- if option is in remote configuration, remove it
168+ stored :delete (file , section [' .name' ], option )
170169 end
171170 end
172- -- remove entire section if empty
173- local result = stored : get_all ( file , section [ ' .name ' ])
174- if result and utils . is_uci_empty ( result ) then
175- stored : delete ( file , section [ ' .name ' ])
176- end
171+ end
172+ -- remove entire section if empty
173+ local result = stored : get_all ( file , section [ ' .name ' ])
174+ if result and utils . is_uci_empty ( result ) then
175+ stored : delete ( file , section [ ' .name ' ])
177176 end
178177 end
179- stored : commit ( file )
180- -- remove uci file if empty
181- local uci_file = stored : get_all ( file )
182- if uci_file and utils . is_table_empty ( uci_file ) then
183- os.remove ( stored_path )
184- end
178+ end
179+ stored : commit ( file )
180+ -- remove uci file if empty
181+ local uci_file = stored : get_all ( file )
182+ if uci_file and utils . is_table_empty ( uci_file ) then
183+ os.remove ( stored_path )
185184 end
186185 end
187186 -- MERGE mode
0 commit comments