X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-mod-admin-full%2Fluasrc%2Fcontroller%2Fadmin%2Fsystem.lua;h=6fcd66f44107e4ecdbcd167c630b4db6a6d31326;hp=cbba48cc25f4180fc587f4e7609426a6798ab77e;hb=c91ba4babc63fcc94771b608ae497a7a2db32b86;hpb=94ab57f48c9a8704a0a7da87bfa6ced9e73ca9be diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua index cbba48cc2..6fcd66f44 100644 --- a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua +++ b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua @@ -21,13 +21,14 @@ 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 end - if fs.access("/sys/class/leds") then + local nodes, number = fs.glob("/sys/class/leds/*") + if number > 0 then entry({"admin", "system", "leds"}, cbi("admin_system/leds"), _("LED Configuration"), 60) end @@ -52,6 +53,7 @@ function action_clock_status() luci.sys.call("date -s '%04d-%02d-%02d %02d:%02d:%02d'" %{ date.year, date.month, date.day, date.hour, date.min, date.sec }) + luci.sys.call("/etc/init.d/sysfixtime restart") end end @@ -185,12 +187,16 @@ local function image_checksum(image) return (luci.sys.exec("md5sum %q" % image):match("^([^%s]+)")) end +local function image_sha256_checksum(image) + return (luci.sys.exec("sha256sum %q" % image):match("^([^%s]+)")) +end + local function supports_sysupgrade() return nixio.fs.access("/lib/upgrade/platform.sh") end local function supports_reset() - return (os.execute([[grep -sq '"rootfs_data"' /proc/mtd]]) == 0) + return (os.execute([[grep -sq "^overlayfs:/overlay / overlay " /proc/mounts]]) == 0) end local function storage_size() @@ -268,6 +274,7 @@ function action_sysupgrade() if image_supported(image_tmp) then luci.template.render("admin_system/upgrade", { checksum = image_checksum(image_tmp), + sha256ch = image_sha256_checksum(image_tmp), storage = storage_size(), size = (fs.stat(image_tmp, "size") or 0), keep = (not not http.formvalue("keep")) @@ -290,7 +297,7 @@ function action_sysupgrade() msg = luci.i18n.translate("The system is flashing now.
DO NOT POWER OFF THE DEVICE!
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 +358,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