Browse Source

Fixes problems with ffho-config-mode-site-select

Karsten Böddeker 8 years ago
parent
commit
50de06d4e3

+ 1 - 1
ffpb/ffho-config-mode-site-select/files/lib/gluon/config-mode/wizard/0200-site-select.lua

@@ -22,7 +22,7 @@ function M.section(form)
 	end
 
 	for index, tmp in pairs(config) do
-		o:value(tmp.site_code, tmp.site_name))
+		o:value(tmp.site_code, tmp.site_name)
 	end
 end
 

+ 11 - 12
ffpb/ffho-config-mode-site-select/files/lib/gluon/upgrade/002-set-site-config

@@ -11,23 +11,23 @@ local currentsite = c:get("currentsite", "current", "name")
 local file = "/etc/sysupgrade.conf"
 local configured = false
 
-function serialize (o)
+function serialize (f,o)
   if type(o) == "number" then
-    io.write(o)
+    f:write(o)
   elseif type(o) == "string" then
-    io.write(string.format("%q", o))
+    f:write(string.format("%q", o))
   elseif type(o) == "boolean" then
-    io.write(o and 1 or 0)
+    f:write(o and 1 or 0)
   elseif type(o) == "table" then
-    io.write("{\n")
+    f:write("{\n")
     for k,v in pairs(o) do
       if type(k) == "string" then
-        io.write("  ", k, " = ")
+        f:write("  ", k, " = ")
       end
-      serialize(v)
-      io.write(",\n")
+      serialize(f,v)
+      f:write(",\n")
     end
-    io.write("}\n")
+    f:write("}")
   else
     error("cannot serialize a " .. type(o))
   end
@@ -70,9 +70,8 @@ if site.site_code ~= currentsite then
   new.batman_on_wan = site.batman_on_wan
 
   file = '/lib/gluon/site.conf'
-  io.output(file)
-  f = io.open(file, 'w')
-  serialize(new)
+  f = io.open(file, "w")
+  serialize(f,new)
   f:write('\n')
   f:close()
 end