module("luci.controller.advanced_reboot", package.seeall)
-uci = require "uci"
-
-- device_name, board_name, part1, part2, offset, env_var_1, value_1_1, value_1_2, env_var_2, value_2_1, value_2_2
devices = {
{"Linksys EA3500", "linksys-audi", "mtd3", "mtd5", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"},
end
function action_reboot()
+ local uci = require "luci.model.uci".cursor()
luci.template.render("admin_system/applyreboot", {
title = luci.i18n.translate("Rebooting..."),
msg = luci.i18n.translate("The system is rebooting 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 = luci.ip.new(uci.cursor():get("network", "lan", "ipaddr")) or "192.168.1.1"
+ addr = luci.ip.new(uci:get("network", "lan", "ipaddr")) or "192.168.1.1"
})
luci.sys.reboot()
end
function action_altreboot()
+ local uci = require "luci.model.uci".cursor()
local zyxelFlagPartition, zyxelBootFlag, zyxelNewBootFlag, errorCode, curEnvSetting, newEnvSetting
errorMessage = ""
errorCode = 0
luci.template.render("admin_system/applyreboot", {
title = luci.i18n.translate("Rebooting..."),
msg = luci.i18n.translate("The system is rebooting to an alternative partition 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 = luci.ip.new(uci.cursor():get("network", "lan", "ipaddr")) or "192.168.1.1"
+ addr = luci.ip.new(uci:get("network", "lan", "ipaddr")) or "192.168.1.1"
})
luci.sys.reboot()
else
end
function action_poweroff()
+ local uci = require "luci.model.uci".cursor()
if luci.http.formvalue("cancel") then
luci.http.redirect(luci.dispatcher.build_url('admin/system/advanced_reboot'))
return
luci.template.render("admin_system/applyreboot", {
title = luci.i18n.translate("Shutting down..."),
msg = luci.i18n.translate("The system is shutting down now.<br /> DO NOT POWER OFF THE DEVICE!<br /> It might be necessary to renew the address of your computer to reach the device again, depending on your settings."),
- addr = luci.ip.new(uci.cursor():get("network", "lan", "ipaddr")) or "192.168.1.1"
+ addr = luci.ip.new(uci:get("network", "lan", "ipaddr")) or "192.168.1.1"
})
luci.sys.call("/sbin/poweroff")
end