luci-0.9: merge r4865 and r4866
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 17 Jun 2009 12:49:16 +0000 (12:49 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 17 Jun 2009 12:49:16 +0000 (12:49 +0000)
modules/admin-full/luasrc/controller/admin/system.lua
modules/admin-mini/luasrc/controller/mini/system.lua

index 399640b52170f6e3aa8908a3afd88ea3c6fec2dd..9f66f17d305492a1dcf374a6b1befa333891a3b2 100644 (file)
@@ -266,15 +266,21 @@ function action_upgrade()
        -- previous pages should arrange the stuff as required.
        if step == 4 then
                if has_platform and has_image and has_support then
-                       -- Next line is to bypass luci.http layer
-                       luci.http.context.eoh = true
-
                        -- Now invoke sysupgrade
                        local keepcfg = keep_avail and luci.http.formvalue("keepcfg") == "1"
-                       os.execute("/sbin/luci-flash %s %q" %{
+                       local fd = io.popen("/sbin/luci-flash %s %q" %{
                                keepcfg and "-k %q" % _keep_pattern() or "", tmpfile
                        })
 
+                       if fd then
+                               while true do
+                                       local ln = fd:read("*l")
+                                       if not ln then break end
+                                       luci.http.write(ln)
+                               end
+                               fd:close()
+                       end
+
                        -- Make sure the device is rebooted
                        luci.sys.reboot()
                end
index bb93a34c472daa3753cb92982616bd91fb7ff1e8..3aae6fa2f7b6a0d0efbf8225a4be7b7bff053a9a 100644 (file)
@@ -149,15 +149,21 @@ function action_upgrade()
        -- previous pages should arrange the stuff as required.
        if step == 4 then
                if has_platform and has_image and has_support then
-                       -- Next line is to bypass luci.http layer
-                       luci.http.context.eoh = true
-
                        -- Now invoke sysupgrade
                        local keepcfg = keep_avail and luci.http.formvalue("keepcfg") == "1"
-                       os.execute("/sbin/luci-flash %s %q" %{
+                       local fd = io.popen("/sbin/luci-flash %s %q" %{
                                keepcfg and "-k %q" % _keep_pattern() or "", tmpfile
                        })
 
+                       if fd then
+                               while true do
+                                       local ln = fd:read("*l")
+                                       if not ln then break end
+                                       luci.http.write(ln)
+                               end
+                               fd:close()
+                       end
+
                        -- Make sure the device is rebooted
                        luci.sys.reboot()
                end