summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-advanced-reboot
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-advanced-reboot')
-rw-r--r--applications/luci-app-advanced-reboot/Makefile20
-rw-r--r--applications/luci-app-advanced-reboot/README.md38
-rw-r--r--applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua202
-rw-r--r--applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/advanced_reboot.htm100
-rw-r--r--applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/alternative_reboot.htm29
-rw-r--r--applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/power_off.htm25
-rw-r--r--applications/luci-app-advanced-reboot/po/ru/advanced-reboot.po163
-rw-r--r--applications/luci-app-advanced-reboot/po/sv/advanced-reboot.po133
-rw-r--r--applications/luci-app-advanced-reboot/po/templates/advanced-reboot.pot129
9 files changed, 839 insertions, 0 deletions
diff --git a/applications/luci-app-advanced-reboot/Makefile b/applications/luci-app-advanced-reboot/Makefile
new file mode 100644
index 0000000000..b1ecf677f0
--- /dev/null
+++ b/applications/luci-app-advanced-reboot/Makefile
@@ -0,0 +1,20 @@
+# Copyright (c) 2017 Stan Grishin (stangri@melmac.net)
+# This is free software, licensed under the GNU General Public License v3.
+
+include $(TOPDIR)/rules.mk
+
+PKG_LICENSE:=GPL-3.0+
+PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
+
+LUCI_TITLE:=Advanced Linksys Reboot Web UI
+LUCI_DESCRIPTION:=Provides Web UI (found under System/Advanced Reboot) to reboot supported Linksys and ZyXEL routers to\
+ an altnerative partition. Also provides Web UI to shut down (power off) your device. Supported dual-partition\
+ routers are listed at https://github.com/stangri/openwrt-luci/blob/luci-app-advanced-reboot/applications/luci-app-advanced-reboot/README.md
+
+LUCI_DEPENDS:=+luci-mod-admin-full
+LUCI_PKGARCH:=all
+PKG_RELEASE:=32
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/applications/luci-app-advanced-reboot/README.md b/applications/luci-app-advanced-reboot/README.md
new file mode 100644
index 0000000000..4fa335fb3f
--- /dev/null
+++ b/applications/luci-app-advanced-reboot/README.md
@@ -0,0 +1,38 @@
+# Advanced Reboot Web UI (luci-app-advanced-reboot)
+
+## Description
+This package allows you to reboot to an alternative partition on the supported (dual-partition) routers and to power off (power down) your OpenWrt/LEDE Project device.
+
+## Supported Devices
+Currently supported dual-partition devices include:
+- Linksys EA3500
+- Linksys E4200v2
+- Linksys EA4500
+- Linksys EA8500
+- Linksys WRT1200AC
+- Linksys WRT1900AC
+- Linksys WRT1900ACv2
+- Linksys WRT1900ACS
+- Linksys WRT3200ACM
+- Linksys WRT32X
+- ZyXEL NBG6817
+
+If you're interested in having your device supported, please post in [LEDE Project Forum Support Thread](https://forum.lede-project.org/t/web-ui-to-reboot-to-another-partition-dual-partition-routers/3423).
+
+## Screenshot (luci-app-advanced-reboot)
+![screenshot](https://raw.githubusercontent.com/stangri/openwrt_packages/master/screenshots/luci-app-advanced-reboot/screenshot01.png "screenshot")
+
+## How to install
+Install ```luci-app-advanced-reboot``` from Web UI or connect to your router via ssh and run the following commands:
+```sh
+opkg update
+opkg install luci-app-advanced-reboot
+```
+
+## Notes/Known Issues
+- When you reboot to a different partition, your current settings (WiFi SSID/password, etc.) will not apply to a different partition. Different partitions might have completely different settings and even firmware.
+- If you reboot to a partition which doesn't allow you to switch boot partitions (like stock vendor firmware), you might not be able to boot back to OpenWrt/LEDE Project unless you reflash it, losing all the settings.
+- Some devices allow you to trigger reboot to an alternative partition by interrupting boot 3 times in a row (by resetting/switching off the device or pulling power). As these methods might be different for different devices, do your own homework.
+
+## Thanks
+I'd like to thank everyone who helped create, test and troubleshoot this package. Without help from [@hnyman](https://github.com/hnyman), [@jpstyves](https://github.com/jpstyves) and many contributions from [@slh](https://github.com/pkgadd) it wouldn't have been possible.
diff --git a/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua b/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua
new file mode 100644
index 0000000000..f4d28145ea
--- /dev/null
+++ b/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua
@@ -0,0 +1,202 @@
+-- Copyright 2017 Stan Grishin <stangri@melmac.net>
+-- Licensed to the public under the Apache License 2.0.
+
+module("luci.controller.advanced_reboot", package.seeall)
+
+devices = {
+ -- deviceName, boardName, partition1, partition2, offset, envVar1, envVar1Value1, envVar1Value2, envVar2, envVar2Value1, envVar2Value2
+ {"Linksys EA3500", "linksys-audi", "mtd3", "mtd5", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"},
+ {"Linksys E4200v2/EA4500", "linksys-viper", "mtd3", "mtd5", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"},
+ {"Linksys EA8500", "ea8500", "mtd13", "mtd15", 32, "boot_part", 1, 2},
+-- {"Linksys EA9500", "linksys-panamera", "mtd3", "mtd6", 28, "boot_part", 1, 2},
+ {"Linksys WRT1200AC", "linksys-caiman", "mtd4", "mtd6", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"},
+ {"Linksys WRT1900AC", "linksys-mamba", "mtd4", "mtd6", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"},
+ {"Linksys WRT1900ACv2", "linksys-cobra", "mtd4", "mtd6", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"},
+ {"Linksys WRT1900ACS", "linksys-shelby", "mtd4", "mtd6", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"},
+ {"Linksys WRT3200ACM", "linksys-rango", "mtd5", "mtd7", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"},
+ {"Linksys WRT32X", "linksys-venom", "mtd5", "mtd7", nil, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"},
+ {"ZyXEL NBG6817","nbg6817","mmcblk0p4","mmcblk0p7", 32, nil, 255, 1}
+}
+
+errorMessage = nil
+rom_board_name = luci.util.trim(luci.sys.exec("cat /tmp/sysinfo/board_name"))
+for i=1, #devices do
+ device_board_name = devices[i][2]:gsub('%p','')
+ if rom_board_name and rom_board_name:gsub('%p',''):match(device_board_name) then
+ device_name = devices[i][1]
+ partition_one_mtd = devices[i][3] or nil
+ partition_two_mtd = devices[i][4] or nil
+ partition_skip = devices[i][5] or nil
+ boot_envvar1 = devices[i][6] or nil
+ boot_envvar1_partition_one = tonumber(devices[i][7]) or nil
+ boot_envvar1_partition_two = tonumber(devices[i][8]) or nil
+ boot_envvar2 = devices[i][9] or nil
+ boot_envvar2_partition_one = devices[i][10] or nil
+ boot_envvar2_partition_two = devices[i][11] or nil
+ if partition_one_mtd and partition_skip then
+ partition_one_label = luci.util.trim(luci.sys.exec("dd if=/dev/" .. partition_one_mtd .. " bs=1 skip=" .. partition_skip .. " count=25" .. " 2>/dev/null"))
+ n, partition_one_version = string.match(partition_one_label, '(Linux)-([%d|.]+)')
+ end
+ if partition_two_mtd and partition_skip then
+ partition_two_label = luci.util.trim(luci.sys.exec("dd if=/dev/" .. partition_two_mtd .. " bs=1 skip=" .. partition_skip .. " count=25" .. " 2>/dev/null"))
+ n, partition_two_version = string.match(partition_two_label, '(Linux)-([%d|.]+)')
+ end
+ if partition_one_label and string.find(partition_one_label, "LEDE") then partition_one_os = "LEDE" end
+ if partition_one_label and string.find(partition_one_label, "OpenWrt") then partition_one_os = "OpenWrt" end
+ if partition_one_label and string.find(partition_one_label, "Linksys") then partition_one_os = "Linksys" end
+ if partition_two_label and string.find(partition_two_label, "LEDE") then partition_two_os = "LEDE" end
+ if partition_two_label and string.find(partition_two_label, "OpenWrt") then partition_two_os = "OpenWrt" end
+ if partition_two_label and string.find(partition_two_label, "Linksys") then partition_two_os = "Linksys" end
+ if device_name and device_name == "ZyXEL NBG6817" then
+ if not partition_one_os then partition_one_os = "ZyXEL" end
+ if not partition_two_os then partition_two_os = "ZyXEL" end
+ end
+ if device_name and device_name == "Linksys WRT32X" then
+ if not partition_one_os then partition_one_os = "Unknown/Compressed" end
+ if not partition_two_os then partition_two_os = "Unknown/Compressed" end
+ end
+ if not partition_one_os then partition_one_os = "Unknown" end
+ if not partition_two_os then partition_two_os = "Unknown" end
+ if partition_one_os and partition_one_version then partition_one_os = partition_one_os .. " (Linux " .. partition_one_version .. ")" end
+ if partition_two_os and partition_two_version then partition_two_os = partition_two_os .. " (Linux " .. partition_two_version .. ")" end
+
+ if device_name and device_name == "ZyXEL NBG6817" then
+ if not zyxelFlagPartition then zyxelFlagPartition = luci.util.trim(luci.sys.exec("source /lib/functions.sh; find_mtd_part 0:DUAL_FLAG")) end
+ if not zyxelFlagPartition then
+ errorMessage = errorMessage .. luci.i18n.translate("Unable to find Dual Boot Flag Partition." .. " ")
+ luci.util.perror(luci.i18n.translate("Unable to find Dual Boot Flag Partition."))
+ else
+ current_partition = tonumber(luci.sys.exec("dd if=" .. zyxelFlagPartition .. " bs=1 count=1 2>/dev/null | hexdump -n 1 -e '1/1 \"%d\"'"))
+ end
+ else
+ if nixio.fs.access("/usr/sbin/fw_printenv") and nixio.fs.access("/usr/sbin/fw_setenv") then
+ current_partition = tonumber(luci.util.trim(luci.sys.exec("/usr/sbin/fw_printenv -n " .. boot_envvar1)))
+ end
+ end
+ other_partition = current_partition == boot_envvar1_partition_two and boot_envvar1_partition_one or boot_envvar1_partition_two
+ end
+end
+
+function index()
+ entry({"admin", "system", "advanced_reboot"}, template("advanced_reboot/advanced_reboot"), _("Advanced Reboot"), 90)
+ entry({"admin", "system", "advanced_reboot", "reboot"}, post("action_reboot"))
+ entry({"admin", "system", "advanced_reboot", "alternative_reboot"}, post("action_altreboot"))
+ entry({"admin", "system", "advanced_reboot", "power_off"}, post("action_poweroff"))
+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: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 = nil
+ errorCode = 0
+ if luci.http.formvalue("cancel") then
+ luci.http.redirect(luci.dispatcher.build_url('admin/system/advanced_reboot'))
+ return
+ end
+ local step = tonumber(luci.http.formvalue("step") or 1)
+ if step == 1 then
+ if device_name and nixio.fs.access("/usr/sbin/fw_printenv") and nixio.fs.access("/usr/sbin/fw_setenv") then
+ luci.template.render("advanced_reboot/alternative_reboot",{})
+ else
+ luci.template.render("advanced_reboot/advanced_reboot",{errorMessage = luci.i18n.translate("No access to fw_printenv or fw_printenv!")})
+ end
+ elseif step == 2 then
+ if boot_envvar1 or boot_envvar2 then -- Linksys devices
+ if boot_envvar1 then
+ curEnvSetting = tonumber(luci.util.trim(luci.sys.exec("/usr/sbin/fw_printenv -n " .. boot_envvar1)))
+ if not curEnvSetting then
+ errorMessage = errorMessage .. luci.i18n.translate("Unable to obtain firmware environment variable") .. ": " .. boot_envvar1 .. ". "
+ luci.util.perror(luci.i18n.translate("Unable to obtain firmware environment variable") .. ": " .. boot_envvar1 .. ".")
+ else
+ newEnvSetting = curEnvSetting == boot_envvar1_partition_one and boot_envvar1_partition_two or boot_envvar1_partition_one
+ errorCode = luci.sys.call("/usr/sbin/fw_setenv " .. boot_envvar1 .. " " .. newEnvSetting)
+ if errorCode ~= 0 then
+ errorMessage = errorMessage .. luci.i18n.translate("Unable to set firmware environment variable") .. ": " .. boot_envvar1 .. " " .. luci.i18n.translate("to") .. " " .. newEnvSetting .. ". "
+ luci.util.perror(luci.i18n.translate("Unable to set firmware environment variable") .. ": " .. boot_envvar1 .. " " .. luci.i18n.translate("to") .. " " .. newEnvSetting .. ".")
+ end
+ end
+ end
+ if boot_envvar2 then
+ curEnvSetting = luci.util.trim(luci.sys.exec("/usr/sbin/fw_printenv -n " .. boot_envvar2))
+ if not curEnvSetting then
+ errorMessage = errorMessage .. luci.i18n.translate("Unable to obtain firmware environment variable") .. ": " .. boot_envvar2 .. ". "
+ luci.util.perror(luci.i18n.translate("Unable to obtain firmware environment variable") .. ": " .. boot_envvar2 .. ".")
+ else
+ newEnvSetting = curEnvSetting == boot_envvar2_partition_one and boot_envvar2_partition_two or boot_envvar2_partition_one
+ errorCode = luci.sys.call("/usr/sbin/fw_setenv " .. boot_envvar2 .. " '" .. newEnvSetting .. "'")
+ if errorCode ~= 0 then
+ errorMessage = errorMessage .. luci.i18n.translate("Unable to set firmware environment variable") .. ": " .. boot_envvar2 .. " " .. luci.i18n.translate("to") .. " " .. newEnvSetting .. ". "
+ luci.util.perror(luci.i18n.translate("Unable to set firmware environment variable") .. ": " .. boot_envvar2 .. " " .. luci.i18n.translate("to") .. " " .. newEnvSetting .. ".")
+ end
+ end
+ end
+ else -- NetGear device
+ if not zyxelFlagPartition then zyxelFlagPartition = luci.util.trim(luci.sys.exec("source /lib/functions.sh; find_mtd_part 0:DUAL_FLAG")) end
+ if not zyxelFlagPartition then
+ errorMessage = errorMessage .. luci.i18n.translate("Unable to find Dual Boot Flag Partition." .. " ")
+ luci.util.perror(luci.i18n.translate("Unable to find Dual Boot Flag Partition."))
+ else
+ zyxelBootFlag = tonumber(luci.sys.exec("dd if=" .. zyxelFlagPartition .. " bs=1 count=1 2>/dev/null | hexdump -n 1 -e '1/1 \"%d\"'"))
+ zyxelNewBootFlag = zyxelBootFlag and zyxelBootFlag == 1 and "\\xff" or "\\x01"
+ if zyxelNewBootFlag then
+ errorCode = luci.sys.call("printf \"" .. zyxelNewBootFlag .. "\" >" .. zyxelFlagPartition )
+ if errorCode ~= 0 then
+ errorMessage = errorMessage .. luci.i18n.translate("Unable to set Dual Boot Flag Partition entry for partition") .. ": " .. zyxelFlagPartition .. ". "
+ luci.util.perror(luci.i18n.translate("Unable to set Dual Boot Flag Partition entry for partition") .. ": " .. zyxelFlagPartition .. ".")
+ end
+ end
+ end
+ end
+ if not errorMessage then
+ 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:get("network", "lan", "ipaddr")) or "192.168.1.1"
+ })
+ luci.sys.reboot()
+ else
+ luci.template.render("advanced_reboot/advanced_reboot",{
+ rom_board_name=rom_board_name,
+ device_name=device_name,
+ boot_envvar1_partition_one=boot_envvar1_partition_one,
+ partition_one_os=partition_one_os,
+ boot_envvar1_partition_two=boot_envvar1_partition_two,
+ partition_two_os=partition_two_os,
+ current_partition=current_partition,
+ errorMessage = errorMessage})
+ end
+ end
+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
+ end
+ local step = tonumber(luci.http.formvalue("step") or 1)
+ if step == 1 then
+ if nixio.fs.access("/sbin/poweroff") then
+ luci.template.render("advanced_reboot/power_off",{})
+ else
+ luci.template.render("advanced_reboot/advanced_reboot",{})
+ end
+ elseif step == 2 then
+ 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:get("network", "lan", "ipaddr")) or "192.168.1.1"
+ })
+ luci.sys.call("/sbin/poweroff")
+ end
+end
diff --git a/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/advanced_reboot.htm b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/advanced_reboot.htm
new file mode 100644
index 0000000000..dcf51c749e
--- /dev/null
+++ b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/advanced_reboot.htm
@@ -0,0 +1,100 @@
+<%#
+ Copyright 2008 Steven Barth <steven@midlink.org>
+ Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
+ Copyright 2017 Stan Grishin <stangri@melmac.net>
+ Licensed to the public under the Apache License 2.0.
+-%>
+
+<%+header%>
+
+<h2 name="content"><%:Advanced Reboot%></h2>
+<br />
+
+<%- local c = require("luci.model.uci").cursor():changes(); if c and next(c) then -%>
+ <p class="alert-message warning"><%:Warning: There are unsaved changes that will get lost on reboot!%></p>
+<%- end -%>
+
+<%- if errorMessage and errorMessage ~= "" then -%>
+ <p class="alert-message warning"><%:ERROR: %><%=errorMessage%></p>
+<%- end -%>
+
+<%- if device_name then -%>
+<fieldset class="cbi-section">
+ <legend><%=device_name%><%: Partitions%></legend>
+ <div class="table cbi-section-table" id="partitions">
+ <div class="tr cbi-section-table-titles">
+ <div class="th cbi-section-table-cell"><%:Partition%></div>
+ <div class="th cbi-section-table-cell"><%:Status%></div>
+ <div class="th cbi-section-table-cell"><%:Firmware/OS (Kernel)%></div>
+ <div class="th cbi-section-table-cell"><%:Action%></div>
+ </div>
+ <div class="tr cbi-section-table-row">
+ <div class="td">
+ <%=string.format("%X", boot_envvar1_partition_one)%>
+ </div>
+ <div class="td">
+ <%- if boot_envvar1_partition_one == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
+ </div>
+ <div class="td">
+ <%=partition_one_os%>
+ </div>
+ <div class="td">
+ <%- if boot_envvar1_partition_one == current_partition then -%>
+ <form method="post" action="<%=url('admin/system/advanced_reboot/reboot')%>">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input id="reboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to current partition%>" />
+ </form>
+ <%- else -%>
+ <form method="post" action="<%=url('admin/system/advanced_reboot/alternative_reboot')%>">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input id="altreboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to alternative partition...%>" />
+ </form>
+ <%- end -%>
+ </div>
+ </div>
+ <div class="tr cbi-section-table-row">
+ <div class="td">
+ <%=string.format("%X", boot_envvar1_partition_two)%>
+ </div>
+ <div class="td">
+ <%- if boot_envvar1_partition_two == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
+ </div>
+ <div class="td">
+ <%=partition_two_os%>
+ </div>
+ <div class="td">
+ <%- if boot_envvar1_partition_two == current_partition then -%>
+ <form method="post" action="<%=url('admin/system/advanced_reboot/reboot')%>">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input id="reboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to current partition%>" />
+ </form>
+ <%- else -%>
+ <form method="post" action="<%=url('admin/system/advanced_reboot/alternative_reboot')%>">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input id="altreboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to alternative partition...%>" />
+ </form>
+ <%- end -%>
+ </div>
+ </div>
+ </div>
+</fieldset>
+<%- else -%>
+ <%- if rom_board_name then -%>
+ <p class="alert-message warning"><%=pcdata(translatef("Warning: Device (%s) is unknown or isn't a dual-partition device!", rom_board_name))%></p>
+ <%- else -%>
+ <p class="alert-message warning"><%:Warning: Unable to obtain device information!%></p>
+ <%- end -%>
+<%- end -%>
+
+<hr />
+
+<%- if nixio.fs.access("/sbin/poweroff") then -%>
+<form method="post" action="<%=url('admin/system/advanced_reboot/power_off')%>">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input id="poweroff-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Perform power off...%>" />
+</form>
+<%- else -%>
+ <p class="alert-message warning"><%:Warning: This system does not support powering off!%></p>
+<%- end -%>
+
+<%+footer%>
diff --git a/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/alternative_reboot.htm b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/alternative_reboot.htm
new file mode 100644
index 0000000000..6325934094
--- /dev/null
+++ b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/alternative_reboot.htm
@@ -0,0 +1,29 @@
+<%#
+ Copyright 2008 Steven Barth <steven@midlink.org>
+ Copyright 2008-2009 Jo-Philipp Wich <jow@openwrt.org>
+ Copyright 2017 Stan Grishin <stangri@melmac.net>
+ Licensed to the public under the Apache License 2.0.
+-%>
+
+<%+header%>
+
+<h2 name="content"><%:Reboot Device to an Alternative Partition%> - <%:Confirm%></h2>
+<p>
+ <%_ WARNING: An alternative partition might have its own settings and completely different firmware.<br /><br />
+ As your network configuration and WiFi SSID/password on alternative partition might be different,
+ you might have to adjust your computer settings to be able to access your device once it reboots.<br /><br />
+ Please also be aware that alternative partition firmware might not provide an easy way to switch active partition
+ and boot back to the currently active partition.<br /><br />
+ Click "Proceed" below to reboot device to an alternative partition. %>
+</p>
+
+<div class="cbi-page-actions right">
+ <form class="inline" action="<%=REQUEST_URI%>" method="post">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input type="hidden" name="step" value="2" />
+ <input class="cbi-button cbi-button-reset" name="cancel" type="submit" value="<%:Cancel%>" />
+ <input class="cbi-button cbi-button-apply" type="submit" value="<%:Proceed%>" />
+ </form>
+</div>
+
+<%+footer%>
diff --git a/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/power_off.htm b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/power_off.htm
new file mode 100644
index 0000000000..0ddea11e65
--- /dev/null
+++ b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/power_off.htm
@@ -0,0 +1,25 @@
+<%#
+ Copyright 2008 Steven Barth <steven@midlink.org>
+ Copyright 2008-2009 Jo-Philipp Wich <jow@openwrt.org>
+ Copyright 2017 Stan Grishin <stangri@melmac.net>
+ Licensed to the public under the Apache License 2.0.
+-%>
+
+<%+header%>
+
+<h2 name="content"><%:Power Off Device%> - <%:Confirm%></h2>
+<p>
+ <%_ WARNING: Power off might result in a reboot on a device which doesn't support power off.<br /><br />
+ Click "Proceed" below to power off your device. %>
+</p>
+
+<div class="cbi-page-actions right">
+ <form class="inline" action="<%=REQUEST_URI%>" method="post">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input type="hidden" name="step" value="2" />
+ <input class="cbi-button cbi-button-reset" name="cancel" type="submit" value="<%:Cancel%>" />
+ <input class="cbi-button cbi-button-apply" type="submit" value="<%:Proceed%>" />
+ </form>
+</div>
+
+<%+footer%>
diff --git a/applications/luci-app-advanced-reboot/po/ru/advanced-reboot.po b/applications/luci-app-advanced-reboot/po/ru/advanced-reboot.po
new file mode 100644
index 0000000000..75d463677b
--- /dev/null
+++ b/applications/luci-app-advanced-reboot/po/ru/advanced-reboot.po
@@ -0,0 +1,163 @@
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Project-Id-Version: LuCI: advanced-reboot\n"
+"POT-Creation-Date: 2017-11-30 15:20+0300\n"
+"PO-Revision-Date: 2018-01-05 19:53+0300\n"
+"Language-Team: http://cyber-place.ru\n"
+"MIME-Version: 1.0\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.8.7.1\n"
+"Last-Translator: Vladimir aka sunny <picfun@ya.ru>\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+"Language: ru\n"
+
+msgid "Action"
+msgstr "Действие"
+
+msgid "Advanced Reboot"
+msgstr "Дополнительная перезагрузка"
+
+msgid "Alternative"
+msgstr "Альтернатива"
+
+msgid "Alternative reboot cancelled."
+msgstr "Альтернативная перезагрузка отменена."
+
+msgid "Cancel"
+msgstr "Отменить"
+
+msgid "Confirm"
+msgstr "Подтвердить"
+
+msgid "Current"
+msgstr "Текущий"
+
+msgid "ERROR:"
+msgstr "ОШИБКА:"
+
+msgid "Firmware/OS (Kernel)"
+msgstr "Прошивка/ОС (Ядро)"
+
+msgid "No access to fw_printenv or fw_printenv!"
+msgstr "Нет доступа к fw_printenv или fw_printenv!"
+
+msgid "Partition"
+msgstr "Раздел"
+
+msgid "Partitions"
+msgstr "Разделы"
+
+msgid "Perform power off..."
+msgstr "Выполнить отключение..."
+
+msgid "Power Off Device"
+msgstr "Отключить питание устройства"
+
+msgid "Proceed"
+msgstr "Продолжить"
+
+msgid "Reboot Device to an Alternative Partition"
+msgstr "Перезагрузить устройство в альтернативный раздел"
+
+msgid "Reboot to alternative partition..."
+msgstr "Перезагрузить до альтернативного раздела..."
+
+msgid "Reboot to current partition"
+msgstr "Перезагрузка к текущему разделу"
+
+msgid "Rebooting..."
+msgstr "Перезагрузка..."
+
+msgid "Shutting down..."
+msgstr "Отключается..."
+
+msgid "Status"
+msgstr "Состояние"
+
+msgid ""
+"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."
+msgstr ""
+"Система перезагружается сейчас.<br /> НЕ ОТКЛЮЧАЙТЕ ПИТАНИЕ УСТРОЙСТВА!<br /"
+"> Подождите несколько минут, прежде чем попытаться установить соединение "
+"снова. Возможно, потребуется обновить адрес компьютера для повторного "
+"доступа к устройству в зависимости от ваших настроек."
+
+msgid ""
+"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."
+msgstr ""
+"Система перезагружается на альтернативный раздел сейчас.<br /> НЕ ОТКЛЮЧАЙТЕ "
+"ПИТАНИЕ УСТРОЙСТВА!<br /> Подождите несколько минут, прежде чем попытаться "
+"установить соединение снова. Возможно, потребуется обновить адрес компьютера "
+"для повторного доступа к устройству в зависимости от ваших настроек."
+
+msgid ""
+"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."
+msgstr ""
+"Система сейчас отключается.<br /> НЕ ОТКЛЮЧАЙТЕ ПИТАНИЕ УСТРОЙСТВА!<br /> "
+"Возможно, потребуется обновить адрес компьютера для повторного доступа к "
+"устройству в зависимости от настроек."
+
+msgid "Unable to find Dual Boot Flag Partition."
+msgstr "Невозможно найти Dual Boot раздел."
+
+msgid "Unable to obtain firmware environment variable"
+msgstr "Невозможно получить переменную среды прошивки"
+
+msgid "Unable to set Dual Boot Flag Partition entry for partition"
+msgstr "Невозможно использовать Dual Boot раздел."
+
+msgid "Unable to set firmware environment variable"
+msgstr "Невозможно установить переменную среды прошивки"
+
+msgid ""
+"WARNING: An alternative partition might have its own settings and completely "
+"different firmware.<br /><br /> As your network configuration and WiFi SSID/"
+"password on alternative partition might be different, you might have to "
+"adjust your computer settings to be able to access your device once it "
+"reboots.<br /><br /> Please also be aware that alternative partition "
+"firmware might not provide an easy way to switch active partition and boot "
+"back to the currently active partition.<br /><br /> Click \"Proceed\" below "
+"to reboot device to an alternative partition."
+msgstr ""
+"ВНИМАНИЕ: альтернативный раздел может иметь собственные настройки и "
+"совершенно другую прошивку.<br /><br /> Поскольку ваши настройки сети и WiFi "
+"SSID/пароли на альтернативных разделах могут отличаться, может потребоваться "
+"изменить настройки компьютера, чтобы иметь возможность получить доступ к "
+"устройству после перезагрузки .<br /><br /> Помните также, что "
+"альтернативный раздел с прошивкой может не обеспечить простой способ "
+"переключения активного раздела и загрузки обратно в текущий активный раздел."
+"<br /><br /> Нажмите \"Продолжить\" ниже, чтобы перезагрузить устройство в "
+"альтернативный раздел."
+
+msgid ""
+"WARNING: Power off might result in a reboot on a device which doesn't "
+"support power off.<br /><br /> Click \"Proceed\" below to power off your "
+"device."
+msgstr ""
+"ВНИМАНИЕ: Отключение питания может привести к перезагрузке устройства, "
+"которое не поддерживает выключение питания.<br /><br /> Нажмите \"Продолжить"
+"\" ниже, чтобы выключить устройство."
+
+msgid "Warning: There are unsaved changes that will get lost on reboot!"
+msgstr ""
+"Внимание: Есть несохраненные изменения, которые будут потеряны при "
+"перезагрузке!"
+
+msgid "Warning: This system does not have two partitions!"
+msgstr "Внимание: Эта система не имеет двух разделов!"
+
+msgid "Warning: This system does not support powering off!"
+msgstr "Внимание: Эта система не поддерживает отключение питания!"
+
+msgid "to"
+msgstr ""
diff --git a/applications/luci-app-advanced-reboot/po/sv/advanced-reboot.po b/applications/luci-app-advanced-reboot/po/sv/advanced-reboot.po
new file mode 100644
index 0000000000..e0e13cfda9
--- /dev/null
+++ b/applications/luci-app-advanced-reboot/po/sv/advanced-reboot.po
@@ -0,0 +1,133 @@
+msgid ""
+msgstr "Content-Type: text/plain; charset=UTF-8\n"
+
+msgid "Action"
+msgstr "Åtgärd"
+
+msgid "Advanced Reboot"
+msgstr "Avancerad omstart"
+
+msgid "Alternative"
+msgstr "Alternativ"
+
+msgid "Alternative reboot cancelled."
+msgstr ""
+
+msgid "Cancel"
+msgstr "Avbryt"
+
+msgid "Confirm"
+msgstr "Bekräfta"
+
+msgid "Current"
+msgstr "Nuvarande"
+
+msgid "ERROR:"
+msgstr ""
+
+msgid "Firmware/OS (Kernel)"
+msgstr "Inre mjukvara/OS (Kärna)"
+
+msgid "No access to fw_printenv or fw_printenv!"
+msgstr ""
+
+msgid "Partition"
+msgstr "Partition"
+
+msgid "Partitions"
+msgstr "Partitioner"
+
+msgid "Perform power off..."
+msgstr "Utför avstängning..."
+
+msgid "Power Off Device"
+msgstr "Stäng av enhet"
+
+msgid "Proceed"
+msgstr "Fortsätt"
+
+msgid "Reboot Device to an Alternative Partition"
+msgstr "Starta om enheten till en alternativ partition"
+
+msgid "Reboot to alternative partition..."
+msgstr "Starta om till alternativ partition..."
+
+msgid "Reboot to current partition"
+msgstr "Starta om till nuvarande partition"
+
+msgid "Rebooting..."
+msgstr "Startar om..."
+
+msgid "Shutting down..."
+msgstr "Stänger av..."
+
+msgid "Status"
+msgstr "Status"
+
+msgid ""
+"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."
+msgstr ""
+
+msgid ""
+"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."
+msgstr ""
+
+msgid ""
+"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."
+msgstr ""
+"Systemet stänger ner nu.<br /> STÄNG INTE AV ENHETEN!<br /> Beroende på dina "
+"inställningar så kan det vara nödvändigt att förnya din dators adress för "
+"att nå enheten igen."
+
+msgid "Unable to find Dual Boot Flag Partition."
+msgstr ""
+
+msgid "Unable to obtain firmware environment variable"
+msgstr ""
+
+msgid "Unable to set Dual Boot Flag Partition entry for partition"
+msgstr ""
+
+msgid "Unable to set firmware environment variable"
+msgstr ""
+
+msgid ""
+"WARNING: An alternative partition might have its own settings and completely "
+"different firmware.<br /><br /> As your network configuration and WiFi SSID/"
+"password on alternative partition might be different, you might have to "
+"adjust your computer settings to be able to access your device once it "
+"reboots.<br /><br /> Please also be aware that alternative partition "
+"firmware might not provide an easy way to switch active partition and boot "
+"back to the currently active partition.<br /><br /> Click \"Proceed\" below "
+"to reboot device to an alternative partition."
+msgstr ""
+
+msgid ""
+"WARNING: Power off might result in a reboot on a device which doesn't "
+"support power off.<br /><br /> Click \"Proceed\" below to power off your "
+"device."
+msgstr ""
+"VARNING: Att stänga av kan resultera i en omstart i en enhet som inte har "
+"stöd för avstängning.<br /><br /> Klicka på \"Fortsätt\" nedanför för att "
+"stänga av din enhet."
+
+msgid "Warning: There are unsaved changes that will get lost on reboot!"
+msgstr ""
+"Varning: Det finns osparade ändringar som kommer att förloras vid omstart!"
+
+msgid "Warning: This system does not have two partitions!"
+msgstr "Varning: Det här systemet har inte två partitioner!"
+
+msgid "Warning: This system does not support powering off!"
+msgstr "Varning: Det här systemet har inte stöd för avstängning!"
+
+msgid "to"
+msgstr ""
diff --git a/applications/luci-app-advanced-reboot/po/templates/advanced-reboot.pot b/applications/luci-app-advanced-reboot/po/templates/advanced-reboot.pot
new file mode 100644
index 0000000000..edc8c2a062
--- /dev/null
+++ b/applications/luci-app-advanced-reboot/po/templates/advanced-reboot.pot
@@ -0,0 +1,129 @@
+msgid ""
+msgstr "Content-Type: text/plain; charset=UTF-8"
+
+msgid ") is unknown or isn't a dual-partition device!"
+msgstr ""
+
+msgid "Action"
+msgstr ""
+
+msgid "Advanced Reboot"
+msgstr ""
+
+msgid "Alternative"
+msgstr ""
+
+msgid "Cancel"
+msgstr ""
+
+msgid "Confirm"
+msgstr ""
+
+msgid "Current"
+msgstr ""
+
+msgid "ERROR:"
+msgstr ""
+
+msgid "Firmware/OS (Kernel)"
+msgstr ""
+
+msgid "No access to fw_printenv or fw_printenv!"
+msgstr ""
+
+msgid "Partition"
+msgstr ""
+
+msgid "Partitions"
+msgstr ""
+
+msgid "Perform power off..."
+msgstr ""
+
+msgid "Power Off Device"
+msgstr ""
+
+msgid "Proceed"
+msgstr ""
+
+msgid "Reboot Device to an Alternative Partition"
+msgstr ""
+
+msgid "Reboot to alternative partition..."
+msgstr ""
+
+msgid "Reboot to current partition"
+msgstr ""
+
+msgid "Rebooting..."
+msgstr ""
+
+msgid "Shutting down..."
+msgstr ""
+
+msgid "Status"
+msgstr ""
+
+msgid ""
+"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."
+msgstr ""
+
+msgid ""
+"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."
+msgstr ""
+
+msgid ""
+"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."
+msgstr ""
+
+msgid "Unable to find Dual Boot Flag Partition."
+msgstr ""
+
+msgid "Unable to obtain firmware environment variable"
+msgstr ""
+
+msgid "Unable to set Dual Boot Flag Partition entry for partition"
+msgstr ""
+
+msgid "Unable to set firmware environment variable"
+msgstr ""
+
+msgid ""
+"WARNING: An alternative partition might have its own settings and completely "
+"different firmware.<br /><br /> As your network configuration and WiFi SSID/"
+"password on alternative partition might be different, you might have to "
+"adjust your computer settings to be able to access your device once it "
+"reboots.<br /><br /> Please also be aware that alternative partition "
+"firmware might not provide an easy way to switch active partition and boot "
+"back to the currently active partition.<br /><br /> Click \"Proceed\" below "
+"to reboot device to an alternative partition."
+msgstr ""
+
+msgid ""
+"WARNING: Power off might result in a reboot on a device which doesn't "
+"support power off.<br /><br /> Click \"Proceed\" below to power off your "
+"device."
+msgstr ""
+
+msgid "Warning: Device ("
+msgstr ""
+
+msgid "Warning: There are unsaved changes that will get lost on reboot!"
+msgstr ""
+
+msgid "Warning: This system does not support powering off!"
+msgstr ""
+
+msgid "Warning: Unable to obtain device information!"
+msgstr ""
+
+msgid "to"
+msgstr ""