+ local pw1 = cursor:get("luci", "main", "_pw1")
+ if pw1 and pw1 ~= "**********" then
+ cursor:delete("luci", "main", "_pw1")
+ require "luci.sys".user.setpasswd("root", pw1)
+ end
+
+ local hn = cursor:get("luci", "main", "_uniquename")
+ if hn then
+ cursor:foreach("system", "system", function(s)
+ cursor:set("system", s[".name"], "hostname", hn)
+ end)
+ cursor:commit("system")
+
+ require "nixio.fs".writefile("/proc/sys/kernel/hostname", hn)
+ cursor:delete("luci", "main", "_uniquename")
+ end
+
+ cursor:commit("luci")