function alt_partition_mount(op_ubi)
local ubi_dev
util.exec('for i in rom overlay firmware; do [ ! -d "$i" ] && mkdir -p "/alt/${i}"; done')
- util.exec("ubidetach -m " .. tostring(op_ubi))
ubi_dev = tostring(util.exec("ubiattach -m " .. tostring(op_ubi)))
_, _, ubi_dev = ubi_dev:find("UBI device number (%d+)")
if not ubi_dev then
end
util.exec("ubiblock --create /dev/ubi" .. ubi_dev .. "_0")
util.exec("mount -t squashfs -o ro /dev/ubiblock" .. ubi_dev .. "_0 /alt/rom")
- util.exec("mount -t ubifs /dev/ubi1_" .. ubi_dev .. " /alt/overlay")
- util.exec("mount -t overlay overlay -o noatime,lowerdir=/alt/rom,upperdir=/alt/overlay/upper,workdir=/alt/overlay/work /alt/firmware")
+ util.exec("mount -t ubifs /dev/ubi" .. ubi_dev .. "_1 /alt/overlay")
+-- util.exec("mount -t overlay overlay -o noatime,lowerdir=/alt/rom,upperdir=/alt/overlay/upper,workdir=/alt/overlay/work /alt/firmware")
end
function alt_partition_unmount(op_ubi)
- util.exec("umount /alt/firmware")
- util.exec("umount /alt/overlay")
- util.exec("umount /alt/rom")
- util.exec("ubiblock --remove /dev/ubi1_0")
- util.exec("ubidetach -m " .. tostring(op_ubi))
- util.exec('rm -rf /alt')
+-- util.exec("[ -d /alt/firmware ] && umount /alt/firmware")
+ util.exec("[ -d /alt/overlay ] && umount /alt/overlay")
+ util.exec("[ -d /alt/rom ] && umount /alt/rom")
+ for i = 0, 10 do
+ if not fs.access("/sys/devices/virtual/ubi/ubi" .. tostring(i) .. "/mtd_num") then break end
+ ubi_mtd = tonumber(util.trim(util.exec("cat /sys/devices/virtual/ubi/ubi" .. i .. "/mtd_num")))
+ if ubi_mtd and ubi_mtd == op_ubi then
+ util.exec("ubiblock --remove /dev/ubi" .. tostring(i) .. "_0")
+ util.exec("ubidetach -m " .. tostring(op_ubi))
+ util.exec('rm -rf /alt')
+ end
+ end
end
devices = {
end
function action_reboot()
- ltemplate.render("admin_system/applyreboot", {
+ ltemplate.render("advanced_reboot/applyreboot", {
title = i18n.translate("Rebooting..."),
msg = 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 = ip.new(type(ip) == "string" and ip or "192.168.1.1") or "192.168.1.1"
end
end
if not errorMessage then
- ltemplate.render("admin_system/applyreboot", {
+ ltemplate.render("advanced_reboot/applyreboot", {
title = i18n.translate("Rebooting..."),
msg = 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 = ip.new(uci:get("network", "lan", "ipaddr")) or "192.168.1.1"
ltemplate.render("advanced_reboot/advanced_reboot",{})
end
elseif step == 2 then
- ltemplate.render("admin_system/applyreboot", {
+ ltemplate.render("advanced_reboot/applyreboot", {
title = i18n.translate("Shutting down..."),
msg = 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 = ip.new(uci:get("network", "lan", "ipaddr")) or "192.168.1.1"