Merge pull request #4152 from stangri/master-luci-app-advanced-reboot

luci-app-advanced-reboot: bugfix: new board names for Linksys WRT-devices
This commit is contained in:
Stan 2020-06-11 12:55:52 -07:00 committed by GitHub
commit 7433b6b7b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 157 additions and 50 deletions

View file

@ -10,10 +10,9 @@ 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\ LUCI_DESCRIPTION:=Provides Web UI (found under System/Advanced Reboot) to reboot supported Linksys and ZyXEL routers to\
an alternative partition. Also provides Web UI to shut down (power off) your device. Supported dual-partition\ an alternative partition. Also provides Web UI to shut down (power off) your device. Supported dual-partition\
routers are listed at https://github.com/openwrt/luci/blob/master/applications/luci-app-advanced-reboot/README.md routers are listed at https://github.com/openwrt/luci/blob/master/applications/luci-app-advanced-reboot/README.md
LUCI_DEPENDS:=+luci-compat +luci-mod-admin-full LUCI_DEPENDS:=+luci-compat +luci-mod-admin-full
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
PKG_RELEASE:=52 PKG_RELEASE:=54
include ../../luci.mk include ../../luci.mk

View file

@ -26,7 +26,7 @@ If your device is not in the list above, however it is a [dual-firmware device](
## Screenshot (luci-app-advanced-reboot) ## Screenshot (luci-app-advanced-reboot)
![screenshot](https://raw.githubusercontent.com/stangri/openwrt_packages/master/screenshots/luci-app-advanced-reboot/screenshot02.png "screenshot") ![screenshot](https://cdn.jsdelivr.net/gh/stangri/openwrt_packages@master/screenshots/luci-app-advanced-reboot/screenshot02.png "screenshot")
## How to install ## How to install
@ -37,7 +37,7 @@ opkg update
opkg install luci-app-advanced-reboot opkg install luci-app-advanced-reboot
``` ```
If the ```luci-app-advanced-reboot``` package is not found in the official feed/repo for your version of OpenWrt/LEDE Project, you will need to [add a custom repo to your router](https://github.com/stangri/openwrt_packages/blob/master/README.md#on-your-router) first. If the ```luci-app-advanced-reboot``` package is not found in the official feed/repo for your version of OpenWrt/LEDE Project, you will need to add a custom repo to your router following instructions on [GitHub](https://github.com/stangri/openwrt_packages/blob/master/README.md#on-your-router)/[jsDelivr](https://cdn.jsdelivr.net/gh/stangri/openwrt_packages@master/README.md#on-your-router) first.
## Notes/Known Issues ## Notes/Known Issues

View file

@ -1,7 +1,7 @@
return { return {
vendorName = "Linksys", vendorName = "Linksys",
deviceName = "E4200v2/EA4500", deviceName = "E4200v2/EA4500",
boardName = "linksys-viper", boardNames = { "linksys-viper", "linksys,viper" },
partition1MTD = "mtd3", partition1MTD = "mtd3",
partition2MTD = "mtd5", partition2MTD = "mtd5",
labelOffset = 32, labelOffset = 32,

View file

@ -1,7 +1,7 @@
return { return {
vendorName = "Linksys", vendorName = "Linksys",
deviceName = "EA3500", deviceName = "EA3500",
boardName = "linksys-audi", boardNames = { "linksys-audi", "linksys,audi" },
partition1MTD = "mtd3", partition1MTD = "mtd3",
partition2MTD = "mtd5", partition2MTD = "mtd5",
labelOffset = 32, labelOffset = 32,

View file

@ -1,7 +1,7 @@
return { return {
vendorName = "Linksys", vendorName = "Linksys",
deviceName = "EA6350v3", deviceName = "EA6350v3",
boardName = "linksys-ea6350v3", boardNames = { "linksys-ea6350v3", "linksys,ea6350v3" },
partition1MTD = "mtd10", partition1MTD = "mtd10",
partition2MTD = "mtd12", partition2MTD = "mtd12",
labelOffset = 192, labelOffset = 192,

View file

@ -1,7 +1,7 @@
return { return {
vendorName = "Linksys", vendorName = "Linksys",
deviceName = "EA8300", deviceName = "EA8300",
boardName = "linksys-ea8300", boardNames = { "linksys-ea8300", "linksys,ea8300" },
partition1MTD = "mtd10", partition1MTD = "mtd10",
partition2MTD = "mtd12", partition2MTD = "mtd12",
labelOffset = 192, labelOffset = 192,

View file

@ -1,7 +1,7 @@
return { return {
vendorName = "Linksys", vendorName = "Linksys",
deviceName = "EA8500", deviceName = "EA8500",
boardName = "linksys-ea8500", boardNames = { "linksys-ea8500", "linksys,ea8500" },
partition1MTD = "mtd13", partition1MTD = "mtd13",
partition2MTD = "mtd15", partition2MTD = "mtd15",
labelOffset = 32, labelOffset = 32,

View file

@ -1,7 +1,7 @@
return { return {
vendorName = "Linksys", vendorName = "Linksys",
deviceName = "WRT1200AC", deviceName = "WRT1200AC",
boardName = "linksys-caiman", boardNames = { "linksys-caiman", "linksys,caiman", "linksys,wrt1200ac" },
partition1MTD = "mtd4", partition1MTD = "mtd4",
partition2MTD = "mtd6", partition2MTD = "mtd6",
labelOffset = 32, labelOffset = 32,

View file

@ -1,7 +1,7 @@
return { return {
vendorName = "Linksys", vendorName = "Linksys",
deviceName = "WRT1900AC", deviceName = "WRT1900ACv1",
boardName = "linksys-mamba", boardNames = { "linksys-mamba", "linksys,mamba", "linksys,wrt1900ac-v1" },
partition1MTD = "mtd4", partition1MTD = "mtd4",
partition2MTD = "mtd6", partition2MTD = "mtd6",
labelOffset = 32, labelOffset = 32,

View file

@ -1,7 +1,7 @@
return { return {
vendorName = "Linksys", vendorName = "Linksys",
deviceName = "WRT1900ACS", deviceName = "WRT1900ACS",
boardName = "linksys-shelby", boardNames = { "linksys-shelby", "linksys,shelby", "linksys,wrt1900acs" },
partition1MTD = "mtd4", partition1MTD = "mtd4",
partition2MTD = "mtd6", partition2MTD = "mtd6",
labelOffset = 32, labelOffset = 32,

View file

@ -1,7 +1,7 @@
return { return {
vendorName = "Linksys", vendorName = "Linksys",
deviceName = "WRT1900ACv2", deviceName = "WRT1900ACv2",
boardName = "linksys-cobra", boardNames = { "linksys-cobra", "linksys,cobra", "linksys,wrt1900ac-v2" },
partition1MTD = "mtd4", partition1MTD = "mtd4",
partition2MTD = "mtd6", partition2MTD = "mtd6",
labelOffset = 32, labelOffset = 32,

View file

@ -1,7 +1,7 @@
return { return {
vendorName = "Linksys", vendorName = "Linksys",
deviceName = "WRT3200ACM", deviceName = "WRT3200ACM",
boardName = "linksys-rango", boardNames = { "linksys-rango", "linksys,rango", "linksys,wrt3200acm" },
partition1MTD = "mtd5", partition1MTD = "mtd5",
partition2MTD = "mtd7", partition2MTD = "mtd7",
labelOffset = 32, labelOffset = 32,

View file

@ -1,7 +1,7 @@
return { return {
vendorName = "Linksys", vendorName = "Linksys",
deviceName = "WRT32X", deviceName = "WRT32X",
boardName = "linksys-venom", boardNames = { "linksys-venom", "linksys,venom", "linksys,wrt32x" },
partition1MTD = "mtd5", partition1MTD = "mtd5",
partition2MTD = "mtd7", partition2MTD = "mtd7",
labelOffset = nil, labelOffset = nil,

View file

@ -1,7 +1,7 @@
return { return {
vendorName = "ZyXEL", vendorName = "ZyXEL",
deviceName = "NBG6817", deviceName = "NBG6817",
boardName = "nbg6817", boardNames = { "nbg6817" },
partition1MTD = "mmcblk0p4", partition1MTD = "mmcblk0p4",
partition2MTD = "mmcblk0p7", partition2MTD = "mmcblk0p7",
labelOffset = 32, labelOffset = 32,

View file

@ -1,4 +1,4 @@
-- Copyright 2017-2018 Stan Grishin <stangri@melmac.net> -- Copyright 2017-2020 Stan Grishin <stangri@melmac.net>
-- Licensed to the public under the Apache License 2.0. -- Licensed to the public under the Apache License 2.0.
module("luci.controller.advanced_reboot", package.seeall) module("luci.controller.advanced_reboot", package.seeall)
@ -98,15 +98,23 @@ function obtain_device_info()
local p_func = loadfile(devices_dir .. filename) local p_func = loadfile(devices_dir .. filename)
setfenv(p_func, { _ = i18n.translate }) setfenv(p_func, { _ = i18n.translate })
p = p_func() p = p_func()
boardName = p.boardName:gsub('%p','') if p.boardName then
boardName = p.boardName:gsub('%p','')
end
if p.boardNames then
for i, v in pairs(p.boardNames) do
boardName = v:gsub('%p','')
if romBoardName and romBoardName:gsub('%p',''):match(boardName) then break end
end
end
if romBoardName and romBoardName:gsub('%p',''):match(boardName) then if romBoardName and romBoardName:gsub('%p',''):match(boardName) then
if p.labelOffset then if p.labelOffset then
if p.partition1MTD then if p.partition1MTD then
p1_label = util.trim(util.exec("dd if=/dev/" .. p.partition1MTD .. " bs=1 skip=" .. p.labelOffset .. " count=128" .. " 2>/dev/null")) p1_label = util.trim(util.exec("dd if=/dev/" .. p.partition1MTD .. " bs=1 skip=" .. p.labelOffset .. " count=128" .. " 2>/dev/null"))
n, p1_version = p1_label:match('(Linux)-([%d|.]+)') n, p1_version = p1_label:match('(Linux)-([%d|.]+)')
end end
if p.partition2MTD then if p.partition2MTD then
p2_label = util.trim(util.exec("dd if=/dev/" .. p.partition2MTD .. " bs=1 skip=" .. p.labelOffset .. " count=128" .. " 2>/dev/null")) p2_label = util.trim(util.exec("dd if=/dev/" .. p.partition2MTD .. " bs=1 skip=" .. p.labelOffset .. " count=128" .. " 2>/dev/null"))
n, p2_version = p2_label:match('(Linux)-([%d|.]+)') n, p2_version = p2_label:match('(Linux)-([%d|.]+)')
end end
if p1_label and p1_label:find("LEDE") then p1_os = "LEDE" end if p1_label and p1_label:find("LEDE") then p1_os = "LEDE" end
@ -160,7 +168,7 @@ function obtain_device_info()
end end
function index() function index()
entry({"admin", "system", "advanced_reboot"}, call("action_template"), _("Advanced Reboot"), 90) entry({"admin", "system", "advanced_reboot"}, call("action_template"), _("Advanced Reboot"), 90).acl_depends = { "luci-app-advanced-reboot" }
entry({"admin", "system", "advanced_reboot", "reboot"}, post("action_reboot")) entry({"admin", "system", "advanced_reboot", "reboot"}, post("action_reboot"))
entry({"admin", "system", "advanced_reboot", "alternative_reboot"}, post("action_altreboot")) entry({"admin", "system", "advanced_reboot", "alternative_reboot"}, post("action_altreboot"))
entry({"admin", "system", "advanced_reboot", "power_off"}, post("action_poweroff")) entry({"admin", "system", "advanced_reboot", "power_off"}, post("action_poweroff"))

View file

@ -1,7 +1,7 @@
msgid "" msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8" msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:163 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:171
#: applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/advanced_reboot.htm:10 #: applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/advanced_reboot.htm:10
msgid "Advanced Reboot" msgid "Advanced Reboot"
msgstr "" msgstr ""
@ -20,8 +20,8 @@ msgstr ""
msgid "Changes applied." msgid "Changes applied."
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:123 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:131
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:124 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:132
msgid "Compressed" msgid "Compressed"
msgstr "" msgstr ""
@ -43,11 +43,15 @@ msgstr ""
msgid "Firmware" msgid "Firmware"
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/root/usr/share/rpcd/acl.d/luci-app-advanced-reboot.json:3
msgid "Grant UCI and file access for luci-app-advanced-reboot"
msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/applyreboot.htm:45 #: applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/applyreboot.htm:45
msgid "Loading" msgid "Loading"
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:205 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:213
msgid "No access to fw_printenv or fw_printenv!" msgid "No access to fw_printenv or fw_printenv!"
msgstr "" msgstr ""
@ -90,14 +94,14 @@ msgstr ""
msgid "Reboot to current partition" msgid "Reboot to current partition"
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:184 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:192
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:256 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:264
#: applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/applyreboot.htm:9 #: applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/applyreboot.htm:9
#: applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/applyreboot.htm:39 #: applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/applyreboot.htm:39
msgid "Rebooting..." msgid "Rebooting..."
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:289 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:297
msgid "Shutting down..." msgid "Shutting down..."
msgstr "" msgstr ""
@ -109,7 +113,7 @@ msgstr ""
msgid "System" msgid "System"
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:185 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:193
msgid "" msgid ""
"The system is rebooting now.<br /> DO NOT POWER OFF THE DEVICE!<br /> Wait a " "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 " "few minutes before you try to reconnect. It might be necessary to renew the "
@ -117,7 +121,7 @@ msgid ""
"settings." "settings."
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:257 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:265
msgid "" msgid ""
"The system is rebooting to an alternative partition now.<br /> DO NOT POWER " "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 " "OFF THE DEVICE!<br /> Wait a few minutes before you try to reconnect. It "
@ -125,43 +129,43 @@ msgid ""
"again, depending on your settings." "again, depending on your settings."
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:290 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:298
msgid "" msgid ""
"The system is shutting down now.<br /> DO NOT POWER OFF THE DEVICE!<br /> It " "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 " "might be necessary to renew the address of your computer to reach the device "
"again, depending on your settings." "again, depending on your settings."
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:136 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:144
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:137 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:145
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:240 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:248
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:241 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:249
msgid "Unable to find Dual Boot Flag Partition." msgid "Unable to find Dual Boot Flag Partition."
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:212 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:220
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:213 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:221
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:226 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:234
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:227 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:235
msgid "Unable to obtain firmware environment variable: %s." msgid "Unable to obtain firmware environment variable: %s."
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:248 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:256
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:249 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:257
msgid "Unable to set Dual Boot Flag Partition entry for partition: %s." msgid "Unable to set Dual Boot Flag Partition entry for partition: %s."
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:218 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:226
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:219 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:227
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:232 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:240
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:233 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:241
msgid "Unable to set firmware environment variable: %s to %s." msgid "Unable to set firmware environment variable: %s to %s."
msgstr "" msgstr ""
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:118 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:126
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:119 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:127
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:123 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:131
#: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:124 #: applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua:132
msgid "Unknown" msgid "Unknown"
msgstr "" msgstr ""

View file

@ -0,0 +1,96 @@
{
"luci-app-advanced-reboot": {
"description": "Grant UCI and file access for luci-app-advanced-reboot",
"read": {
"cgi-io": [
"exec"
],
"file": {
"/usr/lib/lua/luci/advanced-reboot/devices/*": [
"read"
],
"/sys/devices/virtual/ubi/ubi*/mtd_num": [
"read"
],
"/etc/os-release": [
"read"
],
"/alt/rom/etc/os-release": [
"read"
],
"/usr/sbin/fw_printenv *": [
"exec"
],
"/usr/sbin/fw_setenv *": [
"exec"
],
"/usr/sbin/ubiattach *": [
"exec"
],
"/usr/sbin/ubiblock *": [
"exec"
],
"/usr/sbin/ubidetach *": [
"exec"
],
"/usr/sbin/ubinfo *": [
"exec"
],
"/bin/cat *": [
"exec"
],
"/usr/bin/cat *": [
"exec"
],
"/bin/dd *": [
"exec"
],
"/usr/bin/dd *": [
"exec"
],
"/bin/hexdump *": [
"exec"
],
"/usr/bin/hexdump *": [
"exec"
],
"/bin/logger -t advanced-reboot *": [
"exec"
],
"/usr/bin/logger -t advanced-reboot *": [
"exec"
],
"/bin/mkdir *": [
"exec"
],
"/usr/bin/mkdir *": [
"exec"
],
"/bin/mount *": [
"exec"
],
"/usr/bin/mount *": [
"exec"
],
"/bin/printf *": [
"exec"
],
"/usr/bin/printf *": [
"exec"
],
"/bin/rm *": [
"exec"
],
"/usr/bin/rm *": [
"exec"
],
"/lib/functions.sh": [
"exec"
]
},
"uci": [
"network"
]
}
}
}