summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua b/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua
index 8c540521d..b5dd4fe0f 100644
--- a/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua
+++ b/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua
@@ -3,8 +3,6 @@
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"},
@@ -83,15 +81,17 @@ function index()
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
@@ -165,7 +165,7 @@ function action_altreboot()
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
@@ -182,6 +182,7 @@ function action_altreboot()
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
@@ -197,7 +198,7 @@ function action_poweroff()
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