advanced_reboot.htm 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <%#
  2. Copyright 2008 Steven Barth <steven@midlink.org>
  3. Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
  4. Copyright 2017 Stan Grishin <stangri@melmac.net>
  5. Licensed to the public under the Apache License 2.0.
  6. -%>
  7. <%+header%>
  8. <h2 name="content"><%:Advanced Reboot%></h2>
  9. <br />
  10. <%- local c = require("luci.model.uci").cursor():changes(); if c and next(c) then -%>
  11. <p class="alert-message warning"><%:Warning: There are unsaved changes that will get lost on reboot!%></p>
  12. <%- end -%>
  13. <%- if device_name then -%>
  14. <fieldset class="cbi-section">
  15. <legend><%=device_name%><%: Partitions%></legend>
  16. <table class="cbi-section-table" id="partitions">
  17. <tr class="cbi-section-table-titles">
  18. <th class="cbi-section-table-cell"><%:Partition%></th>
  19. <th class="cbi-section-table-cell"><%:Status%></th>
  20. <th class="cbi-section-table-cell"><%:Firmware/OS (Kernel)%></th>
  21. <th class="cbi-section-table-cell"><%:Action%></th>
  22. </tr>
  23. <tr class="cbi-section-table-row">
  24. <td>
  25. <%=boot_envvar1_partition_one%>
  26. </td>
  27. <td>
  28. <%- if boot_envvar1_partition_one == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
  29. </td>
  30. <td>
  31. <%=partition_one_os%>
  32. </td>
  33. <td>
  34. <%- if boot_envvar1_partition_one == current_partition then -%>
  35. <form method="post" action="<%=url('admin/system/advanced_reboot/reboot')%>">
  36. <input type="hidden" name="token" value="<%=token%>" />
  37. <input id="reboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to current partition%>" />
  38. </form>
  39. <%- else -%>
  40. <form method="post" action="<%=url('admin/system/advanced_reboot/alternative_reboot')%>">
  41. <input type="hidden" name="token" value="<%=token%>" />
  42. <input id="altreboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to alternative partition...%>" />
  43. </form>
  44. <%- end -%>
  45. </td>
  46. </tr>
  47. <tr class="cbi-section-table-row">
  48. <td>
  49. <%=boot_envvar1_partition_two%>
  50. </td>
  51. <td>
  52. <%- if boot_envvar1_partition_two == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
  53. </td>
  54. <td>
  55. <%=partition_two_os%>
  56. </td>
  57. <td>
  58. <%- if boot_envvar1_partition_two == current_partition then -%>
  59. <form method="post" action="<%=url('admin/system/advanced_reboot/reboot')%>">
  60. <input type="hidden" name="token" value="<%=token%>" />
  61. <input id="reboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to current partition%>" />
  62. </form>
  63. <%- else -%>
  64. <form method="post" action="<%=url('admin/system/advanced_reboot/alternative_reboot')%>">
  65. <input type="hidden" name="token" value="<%=token%>" />
  66. <input id="altreboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to alternative partition...%>" />
  67. </form>
  68. <%- end -%>
  69. </td>
  70. </tr>
  71. </table>
  72. </fieldset>
  73. <%- else -%>
  74. <p class="alert-message warning"><%:Warning: This system does not have two partitions!%></p>
  75. <%- end -%>
  76. <hr />
  77. <%- if nixio.fs.access("/sbin/poweroff") then -%>
  78. <form method="post" action="<%=url('admin/system/advanced_reboot/power_off')%>">
  79. <input type="hidden" name="token" value="<%=token%>" />
  80. <input id="poweroff-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Perform power off...%>" />
  81. </form>
  82. <%- else -%>
  83. <p class="alert-message warning"><%:Warning: This system does not support powering off!%></p>
  84. <%- end -%>
  85. <%+footer%>