From: Hannu Nyman Date: Wed, 3 Jan 2018 08:59:40 +0000 (+0200) Subject: Merge pull request #1495 from dibdot/travelmate X-Git-Url: http://git.archive.openwrt.org/?a=commitdiff_plain;h=b121f958621efd5d81451e2de3e7d35a828645bc;hp=a4e05483b1c4cb9973d78e3a8312023ee0be5262;p=project%2Fluci.git Merge pull request #1495 from dibdot/travelmate luci-app-travelmate: sync with 1.0.1 --- diff --git a/applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua b/applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua index 4bb404c25..d0453f7d9 100644 --- a/applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua +++ b/applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua @@ -74,7 +74,7 @@ end o2 = s:option(ListValue, "adb_dns", translate("DNS Backend (DNS Directory)"), translate("List of supported DNS backends with their default list export directory.
") .. translate("To overwrite the default path use the 'DNS Directory' option in the extra section below.")) -o2:value("dnsmasq", "dnsmasq (/tmp/dnsmasq.d)") +o2:value("dnsmasq", "dnsmasq (/tmp)") o2:value("unbound", "unbound (/var/lib/unbound)") o2:value("named", "named (/var/lib/bind)") o2:value("kresd", "kresd (/etc/kresd)") @@ -98,10 +98,9 @@ o3.rmempty = false -- Runtime information -ds = s:option(DummyValue, "", translate("Runtime Information")) -ds.template = "cbi/nullsection" +ds = m:section(NamedSection, "global", "adblock", translate("Runtime Information")) -dv1 = s:option(DummyValue, "", translate("Adblock Status")) +dv1 = ds:option(DummyValue, "", translate("Adblock Status")) dv1.template = "adblock/runtime" if parse == nil then dv1.value = translate("n/a") @@ -117,7 +116,7 @@ else end end -dv2 = s:option(DummyValue, "", translate("Adblock Version")) +dv2 = ds:option(DummyValue, "", translate("Adblock Version")) dv2.template = "adblock/runtime" if parse == nil then dv2.value = translate("n/a") @@ -125,7 +124,7 @@ else dv2.value = version end -dv3 = s:option(DummyValue, "", translate("Download Utility (SSL Library)"), +dv3 = ds:option(DummyValue, "", translate("Download Utility (SSL Library)"), translate("For SSL protected blocklist sources you need a suitable SSL library, e.g. 'libustream-ssl' or the wget 'built-in'.")) dv3.template = "adblock/runtime" if parse == nil then @@ -134,7 +133,7 @@ else dv3.value = fetch end -dv4 = s:option(DummyValue, "", translate("DNS Backend (DNS Directory)")) +dv4 = ds:option(DummyValue, "", translate("DNS Backend (DNS Directory)")) dv4.template = "adblock/runtime" if parse == nil then dv4.value = translate("n/a") @@ -142,7 +141,7 @@ else dv4.value = backend end -dv5 = s:option(DummyValue, "", translate("Overall Domains")) +dv5 = ds:option(DummyValue, "", translate("Overall Domains")) dv5.template = "adblock/runtime" if parse == nil then dv5.value = translate("n/a") @@ -150,7 +149,7 @@ else dv5.value = domains end -dv6 = s:option(DummyValue, "", translate("Last Run")) +dv6 = ds:option(DummyValue, "", translate("Last Run")) dv6.template = "adblock/runtime" if parse == nil then dv6.value = translate("n/a") @@ -223,20 +222,37 @@ e7 = e:option(Flag, "adb_whitelist_mode", translate("Whitelist Mode"), e7.default = e7.disabled e7.rmempty = true -e8 = e:option(Value, "adb_dnsdir", translate("DNS Directory"), +e8 = e:option(Flag, "adb_dnsflush", translate("Flush DNS Cache"), + translate("Flush DNS Cache after adblock processing.")) +e8.default = e8.disabled +e8.rmempty = true + +e9 = e:option(Flag, "adb_notify", translate("Email Notification"), + translate("Send notification emails in case of a processing error or if domain count is ≤ 0.
") + .. translate("Please note: this needs additional 'mstmp' installation and setup (see readme).")) +e9.default = e9.disabled +e9.rmempty = true + +e10 = e:option(Value, "adb_notifycnt", translate("Email Notification Count"), +translate("Raise minimum domain count email notification trigger, to get emails if the overall count is ≤ the given limit (default 0).")) +e10.default = 0 +e10.datatype = "min(0)" +e10.optional = true + +e11 = e:option(Value, "adb_dnsdir", translate("DNS Directory"), translate("Target directory for the generated blocklist 'adb_list.overall'.")) -e8.datatype = "directory" -e8.optional = true +e11.datatype = "directory" +e11.optional = true -e9 = e:option(Value, "adb_whitelist", translate("Whitelist File"), +e12 = e:option(Value, "adb_whitelist", translate("Whitelist File"), translate("Full path to the whitelist file.")) -e9.datatype = "file" -e9.default = "/etc/adblock/adblock.whitelist" -e9.optional = true +e12.datatype = "file" +e12.default = "/etc/adblock/adblock.whitelist" +e12.optional = true -e10 = e:option(Value, "adb_triggerdelay", translate("Trigger Delay"), +e13 = e:option(Value, "adb_triggerdelay", translate("Trigger Delay"), translate("Additional trigger delay in seconds before adblock processing begins.")) -e10.datatype = "range(1,60)" -e10.optional = true +e13.datatype = "range(1,60)" +e13.optional = true return m diff --git a/applications/luci-app-advanced-reboot/Makefile b/applications/luci-app-advanced-reboot/Makefile index 3a886eb8d..5722b429e 100644 --- a/applications/luci-app-advanced-reboot/Makefile +++ b/applications/luci-app-advanced-reboot/Makefile @@ -7,13 +7,13 @@ PKG_LICENSE:=GPL-3.0+ PKG_MAINTAINER:=Stan Grishin LUCI_TITLE:=Advanced Linksys Reboot Web UI -LUCI_DESCRIPTION:=Provides Web UI (found under System/Advanced Reboot) to reboot supported Linksys routers to\ +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 LUCI_PKGARCH:=all -PKG_RELEASE:=23 +PKG_RELEASE:=25 include ../../luci.mk diff --git a/applications/luci-app-advanced-reboot/README.md b/applications/luci-app-advanced-reboot/README.md index ee87a0002..cfee18810 100644 --- a/applications/luci-app-advanced-reboot/README.md +++ b/applications/luci-app-advanced-reboot/README.md @@ -5,15 +5,16 @@ This package allows you to reboot to an alternative partition on supported (dual ## 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 E4200v2 -- Linksys EA4500 -- Linksys EA8500 - +- 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) @@ -28,8 +29,8 @@ 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 Linksys firmware), you might not be able to boot back to OpenWrt/LEDE Project unless you reflash it, loosing all the settings. +- 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, loosing all the settings. - Some devices allow you to trigger reboot to 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 contributions from [@hnyman](https://github.com/hnyman) and [@jpstyves](https://github.com/jpstyves) it wouldn't have been possible. +I'd like to thank everyone who helped create, test and troubleshoot this package. Without contributions from [@hnyman](https://github.com/hnyman), [@jpstyves](https://github.com/jpstyves) and [@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 index 2b55217b8..13d1c73cc 100644 --- a/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua +++ b/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua @@ -5,15 +5,18 @@ module("luci.controller.advanced_reboot", package.seeall) -- device, 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"}, + {"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 WRT1200AC", "armada-385-linksys-caiman", "mtd4", "mtd6", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"}, {"Linksys WRT1900AC", "armada-xp-linksys-mamba", "mtd4", "mtd6", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"}, {"Linksys WRT1900ACv2", "armada-385-linksys-cobra", "mtd4", "mtd6", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"}, {"Linksys WRT1900ACS", "armada-385-linksys-shelby", "mtd4", "mtd6", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"}, {"Linksys WRT3200ACM", "armada-385-linksys-rango", "mtd5", "mtd7", 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} + {"ZyXEL NBG6817","nbg6817","mmcblk0p4","mmcblk0p7",32,nil,255,1} } +errorMessage = "" board_name = luci.util.trim(luci.sys.exec("cat /tmp/sysinfo/board_name")) for i=1, #devices do if board_name and devices[i][2] == board_name then @@ -41,14 +44,29 @@ for i=1, #devices do if string.find(partition_two_label, "LEDE") then partition_two_os = "LEDE" end if string.find(partition_two_label, "OpenWrt") then partition_two_os = "OpenWrt" end if 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 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 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))) - other_partition = current_partition == boot_envvar1_partition_one and boot_envvar1_partition_two or boot_envvar1_partition_one + + 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 @@ -70,8 +88,19 @@ function action_reboot() end function action_altreboot() + local zyxelFlagPartition, zyxelBootFlag, zyxelNewBootFlag, errorCode, curEnvSetting, newEnvSetting + errorMessage = "" + errorCode = 0 if luci.http.formvalue("cancel") then luci.http.redirect(luci.dispatcher.build_url('admin/system/advanced_reboot')) +-- luci.template.render("advanced_reboot/advanced_reboot",{ +-- 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 = luci.i18n.translate("Alternative reboot cancelled.")}) return end local step = tonumber(luci.http.formvalue("step") or 1) @@ -79,21 +108,72 @@ function action_altreboot() 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",{}) + luci.template.render("advanced_reboot/advanced_reboot",{errorMessage = luci.i18n.translate("No access to fw_printenv or fw_printenv!")}) end elseif step == 2 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.
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 = luci.ip.new(uci.cursor():get("network", "lan", "ipaddr")) or "192.168.1.1" - }) - if boot_envvar1 then env1 = tonumber(luci.util.trim(luci.sys.exec("/usr/sbin/fw_printenv -n " .. boot_envvar1))) end - if boot_envvar2 then env2 = luci.util.trim(luci.sys.exec("/usr/sbin/fw_printenv -n " .. boot_envvar2)) end - if env1 and env1 == boot_envvar1_partition_one then luci.sys.call("/usr/sbin/fw_setenv " .. boot_envvar1 .. " " .. boot_envvar1_partition_two) end - if env1 and env1 == boot_envvar1_partition_two then luci.sys.call("/usr/sbin/fw_setenv " .. boot_envvar1 .. " " .. boot_envvar1_partition_one) end - if env2 and env2 == boot_envvar2_partition_one then luci.sys.call("/usr/sbin/fw_setenv " .. boot_envvar2 .. " '" .. boot_envvar2_partition_two .. "'") end - if env2 and env2 == boot_envvar2_partition_two then luci.sys.call("/usr/sbin/fw_setenv " .. boot_envvar2 .. " '" .. boot_envvar2_partition_one .. "'") end - luci.sys.reboot() + 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 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.
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 = luci.ip.new(uci.cursor():get("network", "lan", "ipaddr")) or "192.168.1.1" + }) + luci.sys.reboot() + else + luci.template.render("advanced_reboot/advanced_reboot",{ + 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 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 index 206d25054..0629c84b3 100644 --- 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 @@ -14,6 +14,10 @@

<%:Warning: There are unsaved changes that will get lost on reboot!%>

<%- end -%> +<%- if errorMessage and errorMessage ~= "" then -%> +

<%:ERROR: %><%=errorMessage%>

+<%- end -%> + <%- if device_name then -%>
<%=device_name%><%: Partitions%> @@ -26,7 +30,7 @@ - <%=boot_envvar1_partition_one%> + <%=string.format("%X", boot_envvar1_partition_one)%> <%- if boot_envvar1_partition_one == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%> @@ -50,7 +54,7 @@ - <%=boot_envvar1_partition_two%> + <%=string.format("%X", boot_envvar1_partition_two)%> <%- if boot_envvar1_partition_two == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%> diff --git a/applications/luci-app-advanced-reboot/po/sv/luci-app-advanced-reboot.po b/applications/luci-app-advanced-reboot/po/sv/luci-app-advanced-reboot.po index 20d77cbcf..e0e13cfda 100644 --- a/applications/luci-app-advanced-reboot/po/sv/luci-app-advanced-reboot.po +++ b/applications/luci-app-advanced-reboot/po/sv/luci-app-advanced-reboot.po @@ -10,6 +10,9 @@ msgstr "Avancerad omstart" msgid "Alternative" msgstr "Alternativ" +msgid "Alternative reboot cancelled." +msgstr "" + msgid "Cancel" msgstr "Avbryt" @@ -19,9 +22,15 @@ 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" @@ -78,6 +87,18 @@ msgstr "" "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.

As your network configuration and WiFi SSID/" @@ -107,3 +128,6 @@ 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/luci-app-advanced-reboot.pot b/applications/luci-app-advanced-reboot/po/templates/luci-app-advanced-reboot.pot index 9c810892c..47a81e1dd 100644 --- a/applications/luci-app-advanced-reboot/po/templates/luci-app-advanced-reboot.pot +++ b/applications/luci-app-advanced-reboot/po/templates/luci-app-advanced-reboot.pot @@ -10,6 +10,9 @@ msgstr "" msgid "Alternative" msgstr "" +msgid "Alternative reboot cancelled." +msgstr "" + msgid "Cancel" msgstr "" @@ -19,9 +22,15 @@ 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 "" @@ -75,6 +84,18 @@ msgid "" "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.

As your network configuration and WiFi SSID/" @@ -100,3 +121,6 @@ msgstr "" msgid "Warning: This system does not support powering off!" msgstr "" + +msgid "to" +msgstr "" diff --git a/applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm b/applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm index 847ad5cfb..0a8c65ebd 100644 --- a/applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm +++ b/applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm @@ -71,15 +71,14 @@ end apply_acls("/usr/share/rpcd/acl.d/attendedsysupgrade.json", luci.dispatcher.context.authsession) - apply_acls("/usr/share/rpcd/acl.d/packagelist.json", luci.dispatcher.context.authsession) %> <%+header%>

<%:Attended Sysupgrade%>

- Easily search and install new releases and package upgrades. Sysupgrade images are created on demand based on locally installed packages. + Easily search and install new releases and package upgrades. Sysupgrade firmware are created on demand based on locally installed packages.
- - + +

@@ -89,7 +88,7 @@

- + <%+footer%> diff --git a/applications/luci-app-attendedsysupgrade/root/usr/share/rpcd/acl.d/attendedsysupgrade.json b/applications/luci-app-attendedsysupgrade/root/usr/share/rpcd/acl.d/attendedsysupgrade.json index 97aa81492..754931926 100644 --- a/applications/luci-app-attendedsysupgrade/root/usr/share/rpcd/acl.d/attendedsysupgrade.json +++ b/applications/luci-app-attendedsysupgrade/root/usr/share/rpcd/acl.d/attendedsysupgrade.json @@ -4,10 +4,12 @@ "read": { "ubus": { "rpc-sys": [ - "upgrade_start" + "upgrade_start", + "packagelist" ], "system": [ - "board" + "board", + "info" ], "uci": [ "get", "set", "commit" diff --git a/applications/luci-app-attendedsysupgrade/root/www/luci-static/resources/attendedsysupgrade.js b/applications/luci-app-attendedsysupgrade/root/www/luci-static/resources/attendedsysupgrade.js new file mode 100644 index 000000000..c2fe81d58 --- /dev/null +++ b/applications/luci-app-attendedsysupgrade/root/www/luci-static/resources/attendedsysupgrade.js @@ -0,0 +1,402 @@ +function $(s) { + return document.getElementById(s.substring(1)); +} + +function show(s) { + $(s).style.display = 'block'; +} + +function hide(s) { + $(s).style.display = 'none'; +} + +function set_server() { + hide("#error_box"); + data.url = $("#server").value; + ubus_call("uci", "set", { "config": "attendedsysupgrade", "section": "server", values: { "url": data.url } }) + ubus_call("uci", "commit", { "config": "attendedsysupgrade" }) + var server_button = $("#server") + server_button.type = 'button'; + server_button.className = 'cbi-button cbi-button-edit'; + server_button.parentElement.removeChild($("#button_set")); + server_button.onclick = edit_server; +} + +function edit_server() { + $("#server").type = 'text'; + $("#server").onkeydown = function(event) { + if(event.key === 'Enter') { + set_server(); + return false; + } + } + $("#server").className = ''; + $("#server").onclick = null; + + button_set = document.createElement("input"); + button_set.type = "button"; + button_set.value = "Save"; + button_set.name = "button_set"; + button_set.id = "button_set"; + button_set.className = 'cbi-button cbi-button-edit'; + button_set.style = 'background-image: url("/luci-static/resources/cbi/save.gif");' + button_set.onclick = set_server + $("#server").parentElement.appendChild(button_set); +} + +function edit_packages() { + data.edit_packages = true + hide("#edit_button"); + $("#edit_packages").value = data.packages.join("\n"); + show("#edit_packages"); +} + +// requests to the upgrade server +function server_request(request_dict, path, callback) { + request_dict.distro = data.release.distribution; + request_dict.target = data.release.target.split("\/")[0]; + request_dict.subtarget = data.release.target.split("\/")[1]; + var request = new XMLHttpRequest(); + request.open("POST", data.url + "/" + path, true); + request.setRequestHeader("Content-type", "application/json"); + request.send(JSON.stringify(request_dict)); + request.onerror = function(e) { + error_box("upgrade server down") + show("#server_div"); + } + request.addEventListener('load', function(event) { + callback(request) + }); +} + +// initial setup, get system information +function setup() { + ubus_call("rpc-sys", "packagelist", {}, "packages"); + ubus_call("system", "board", {}, "release"); + ubus_call("system", "board", {}, "board_name"); + ubus_call("system", "board", {}, "model"); + ubus_call("system", "info", {}, "memory"); + uci_get({ "config": "attendedsysupgrade", "section": "server", "option": "url" }) + uci_get({ "config": "attendedsysupgrade", "section": "client", "option": "upgrade_packages" }) + uci_get({ "config": "attendedsysupgrade", "section": "client", "option": "advanced_mode" }) + uci_get({ "config": "attendedsysupgrade", "section": "client", "option": "auto_search" }) + setup_ready(); +} + +function setup_ready() { + // checks if a async ubus calls have finished + if(ubus_counter != ubus_closed) { + setTimeout(setup_ready, 300) + } else { + if(data.auto_search == 1) { + upgrade_check(); + } else { + show("#upgrade_button"); + show("#server_div"); + $("#server").value = data.url; + } + } +} + +function uci_get(option) { + // simple wrapper to get a uci value store in data.