Web UI to reboot to another partition (for Linksys/ZyXEL dual-partition routers) and to power off/power down

In build 17 I've tried to implement the two-step reboot to alternative partition and power off. Warning texts are incomplete, there're just placeholders there, however functionality should work.

Known issue: both Cancel and Proceed buttons on step 1 are treated equally. :wink:

@hnyman and all -- please provide feedback on version 19. It is feature-complete, if anything needs adjusting before I submit a PR to official repo, please post.

I will compile a test version for myself. But while extracting your sources from the -19 .ipk package, I noticed (or actually "git diff" noticed) that there are lots of white space errors (spaces before tabs). You should polish that before a PR.

I will test the -19 package later today.

I'm using Atom with its default setting for tabbing, I've noticed it sometimes inserts spaces and sometimes tabs, not sure what the recommended practice is.

The tree is here: https://github.com/stangri/openwrt-luci/tree/luci-app-advanced-reboot/applications/luci-app-advanced-reboot

Great, you just updated the Github tree. Makes much easier to suggest possible changes :wink:

(I looked a few minutes ago at the tree and there was only the early June version...)

Thanks @stangri , I'll test and report ASAP (Cisco E4200V2).

It works otherwise ok (alternative reboot, reboot to the same partition, poweroff), but always leads the browser to 192.168.1.1 which is a naive assumption. (The controller file seems to have hardcoded 192.168.1.1 in three places.)

My wrt3200acm has 192.168.1.2 as its address and when I first rebooted it, browser brought up my R7800 from 192.168.1.1. I took me a few seconds to realise that the wrong router was displayed.

That is a regression from your previous version that had no hard-code router addresses.

Otherwise it seems good to me. Great app.

1 Like

I remember having a discussion in github comments about 192.168.1.1 being hardcoded in reset/sysupgrade files (and me arguing that it should grab current IP to monitor) and the conclusion was "it's ok, because it's the most probable ip for most scenarios". :wink:

So I kept it in line with the other files from luci-mod-admin-full, but since I have your support to change that now (at least in my app), I will grab current router's IP to monitor. It's still a wild shot when rebooting to alternative partition, but I'd guess majority of people have similar configs on both partitions. At least router's IP is likely to be the same.

Should be fixed in revision 20.

Oh, any idea how can I tell if the device supports power off or will it just restart?

My device doesn't go to a real power off but a halt kind of mode (like in the old days of windows 95 when you had to power off the PC yourself ;-)) but that is what I expect to have a clean shutdown.

Are you after a way to allow power off only if the device supports it?

Ideally, I'd like to not show the power off button if it results in reset. For devices without the clean shutdown I want to be able to show additional warning comparing to the devices where shutdown is expected to complete cleanly.

No idea. I think that it can't be found out anywhere, as it is likely tied directly to CPU models and various halt states implemented in them.

thanks, the version 21 works as expected.

I noticed two typos "partittion" in the warning/confirmation screen.
You should fix those (and the white space errors), but otherwise this looks like ready for PR.

Please also consider again adding "linksys" to the app name. So far all supported router are from Linksys.

At least add "Linksys" clearly to the package Makefile LUCI_TITLE so that users will not install the app for other routers.

You could also add a proper LUCI_DESCRIPTION to explain the functionality (for dual-partition routers from Linksys etc.). Something like in https://github.com/openwrt/luci/blob/master/collections/luci-ssl-openssl/Makefile

1 Like

I did extensive testings on version 21 using your repo and with my device everything is working as expected. Thank you for your app, nice interface with confirmations: everything works!

Effectively, here and there.

1 Like

Just there, just like I pointed out to Stan a few hours ago directly at Github :wink:
https://github.com/stangri/openwrt-luci/commit/0a0b1201403e77c25c0396fb29c94998b736d877
(note the comments there)

Thanks for the heads up, I'm very new to using GitHub :blush:

Good eye, fixed.

Added. However Power Off functionality can still be useful on a bunch of other routers.

Any idea how can I force a line-break in the LUCI_DESCRIPTION and to have an actual line break in the output of 'opkg info'? I've searched for LUCI_DESCRIPTION on github and there's only one app using it you've already referenced to.

Another question -- is there a "recommended practice" document for packages regarding tabulation? As I said I've used standard Atom setting (which I believe by default inserts two spaces and only puts in a tab when there's 8 spaces total), I can adjust this setting and re-format the code for all packages I've created, but using regular (8-spaces) tabs for each indentation looks like a waste of space to me.

I don't think that you can force line breaks there. It might be possible somehow, but is rather unessential so don't spend time on that.

There is no indentation guide but pure tabs is the most used practice.
Your code had lines that started with spaces and continued with tabs, and that is wrong. Git nicely points those lines out.
(tabs+spaces is naturally ok, but not spaces+tabs)

Thanks to everyone who tested and reported back (yes, I'm looking at you Jean-Pierre ;)) and to Hannu for guidance -- I've submitted current version to official repo.

1 Like