luci-mod-admin-full: switch to POST action for reboot
[project/luci.git] / modules / luci-mod-admin-full / luasrc / controller / admin / system.lua
index 055142b..64af555 100644 (file)
@@ -21,7 +21,7 @@ function index()
        entry({"admin", "system", "startup"}, form("admin_system/startup"), _("Startup"), 45)
        entry({"admin", "system", "crontab"}, form("admin_system/crontab"), _("Scheduled Tasks"), 46)
 
-       if fs.access("/etc/config/fstab") then
+       if fs.access("/sbin/block") then
                entry({"admin", "system", "fstab"}, cbi("admin_system/fstab"), _("Mount Points"), 50)
                entry({"admin", "system", "fstab", "mount"}, cbi("admin_system/fstab/mount"), nil).leaf = true
                entry({"admin", "system", "fstab", "swap"},  cbi("admin_system/fstab/swap"),  nil).leaf = true
@@ -34,7 +34,8 @@ function index()
        entry({"admin", "system", "flashops"}, call("action_flashops"), _("Backup / Flash Firmware"), 70)
        entry({"admin", "system", "flashops", "backupfiles"}, form("admin_system/backupfiles"))
 
-       entry({"admin", "system", "reboot"}, call("action_reboot"), _("Reboot"), 90)
+       entry({"admin", "system", "reboot"}, template("admin_system/reboot"), _("Reboot"), 90)
+       entry({"admin", "system", "reboot", "call"}, post("action_reboot"))
 end
 
 function action_clock_status()
@@ -178,13 +179,7 @@ function action_flashops()
        local image_tmp   = "/tmp/firmware.img"
 
        local function image_supported()
-               -- XXX: yay...
-               return ( 0 == os.execute(
-                       ". /lib/functions.sh; " ..
-                       "include /lib/upgrade; " ..
-                       "platform_check_image %q >/dev/null"
-                               % image_tmp
-               ) )
+               return (os.execute("sysupgrade -T %q >/dev/null" % image_tmp) == 0)
        end
 
        local function image_checksum()
@@ -322,11 +317,7 @@ function action_passwd()
 end
 
 function action_reboot()
-       local reboot = luci.http.formvalue("reboot")
-       luci.template.render("admin_system/reboot", {reboot=reboot})
-       if reboot then
-               luci.sys.reboot()
-       end
+       luci.sys.reboot()
 end
 
 function fork_exec(command)