From 1097fadc9250ff49fdca98b37119c5bf281b8ffe Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 28 Jan 2014 03:16:56 +0100 Subject: [PATCH] gluon-config-mode: correct hostname on reboot.html Display the correct hostname on the final page of configmode. Previously, this page used to simply call luci.sys.hostname() which would return the current hostname. However, when the configmode changes the hostname luci.sys.hostname() will not reflect this. This patch fetches the hostname directly from the UCI system config. This adds a variable called 'hostname' which may be used in site.conf at config_mode.msg_reboot and .msg_pubkey. --- .../usr/lib/lua/luci/controller/gluon-config-mode/index.lua | 5 ++++- .../usr/lib/lua/luci/view/gluon-config-mode/reboot.htm | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index 1842caaf..906d926a 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -58,8 +58,11 @@ function action_reboot() uci:save("gluon-config-mode") uci:commit("gluon-config-mode") + hostname = uci:get_first("system", "system", "hostname") + if nixio.fork() ~= 0 then - luci.template.render("gluon-config-mode/reboot", {pubkey=pubkey}) + luci.template.render("gluon-config-mode/reboot", + {pubkey=pubkey, hostname=hostname}) else debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null')) io.stdout:close() diff --git a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm index 27be9385..26a09a2f 100644 --- a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm +++ b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm @@ -15,7 +15,7 @@ $Id$ - <%=luci.sys.hostname()%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %> + <%=hostname%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %> @@ -28,7 +28,7 @@ $Id$ @config_mode.msg_pubkey@

- # <%=luci.sys.hostname()%> + # <%=hostname%>
<%=pubkey%>