diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-27 02:01:36 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-27 02:01:36 +0000 |
commit | eaaaa39c1733540c1bc19b0c1fd9f1c5083aaa75 (patch) | |
tree | 30eeed2b41eea6da4fa835969ec76c4d602875d3 | |
parent | 11527683bf98eabcbff2507aa894bd71a96167e8 (diff) |
modules/admin-{mini,full}: start sysupgrade in background
-rw-r--r-- | modules/admin-full/luasrc/controller/admin/system.lua | 12 | ||||
-rw-r--r-- | modules/admin-mini/luasrc/controller/mini/system.lua | 12 |
2 files changed, 6 insertions, 18 deletions
diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index 432d803b2..d420b2427 100644 --- a/modules/admin-full/luasrc/controller/admin/system.lua +++ b/modules/admin-full/luasrc/controller/admin/system.lua @@ -270,21 +270,15 @@ function action_upgrade() if has_platform and has_image and has_support then -- Mimetype text/plain luci.http.prepare_content("text/plain") + luci.http.write("Starting luci-flash...\n") -- Now invoke sysupgrade local keepcfg = keep_avail and luci.http.formvalue("keepcfg") == "1" - local fd = io.popen("/sbin/luci-flash %s %q" %{ + local flash = ltn12_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 .. "\n") - end - fd:close() - end + luci.ltn12.pump.all(flash, luci.http.write) -- Make sure the device is rebooted luci.sys.reboot() diff --git a/modules/admin-mini/luasrc/controller/mini/system.lua b/modules/admin-mini/luasrc/controller/mini/system.lua index 93f113a32..44d0688f6 100644 --- a/modules/admin-mini/luasrc/controller/mini/system.lua +++ b/modules/admin-mini/luasrc/controller/mini/system.lua @@ -151,21 +151,15 @@ function action_upgrade() if has_platform and has_image and has_support then -- Mimetype text/plain luci.http.prepare_content("text/plain") + luci.http.write("Starting luci-flash...\n") -- Now invoke sysupgrade local keepcfg = keep_avail and luci.http.formvalue("keepcfg") == "1" - local fd = io.popen("/sbin/luci-flash %s %q" %{ + local flash = ltn12_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 .. "\n") - end - fd:close() - end + luci.ltn12.pump.all(flash, luci.http.write) -- Make sure the device is rebooted luci.sys.reboot() |