Merge pull request #727 from LipkeGu/patch-1
[project/luci.git] / modules / luci-mod-admin-full / luasrc / controller / admin / system.lua
index cbba48c..fd6dda1 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("/sbin/block") then
+       if fs.access("/sbin/block") and fs.access("/etc/config/fstab") 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
@@ -190,7 +190,7 @@ local function supports_sysupgrade()
 end
 
 local function supports_reset()
-       return (os.execute([[grep -sq '"rootfs_data"' /proc/mtd]]) == 0)
+       return (os.execute([[grep -sqE '"rootfs_data"|"ubi"' /proc/mtd]]) == 0)
 end
 
 local function storage_size()
@@ -290,7 +290,7 @@ function action_sysupgrade()
                        msg   = luci.i18n.translate("The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> Wait a few minutes before you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings."),
                        addr  = (#keep > 0) and "192.168.1.1" or nil
                })
-               fork_exec("killall dropbear uhttpd; sleep 1; /sbin/sysupgrade %s %q" %{ keep, image_tmp })
+               fork_exec("sleep 1; killall dropbear uhttpd; sleep 1; /sbin/sysupgrade %s %q" %{ keep, image_tmp })
        end
 end
 
@@ -351,7 +351,7 @@ function action_reset()
                        addr  = "192.168.1.1"
                })
 
-               fork_exec("killall dropbear uhttpd; sleep 1; mtd -r erase rootfs_data")
+               fork_exec("sleep 1; killall dropbear uhttpd; sleep 1; jffs2reset -y && reboot")
                return
        end