Skip to content
Snippets Groups Projects
Commit 1097fadc authored by Nils Schneider's avatar Nils Schneider
Browse files

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.
parent 5bb4cf4e
No related branches found
No related tags found
No related merge requests found
...@@ -58,8 +58,11 @@ function action_reboot() ...@@ -58,8 +58,11 @@ function action_reboot()
uci:save("gluon-config-mode") uci:save("gluon-config-mode")
uci:commit("gluon-config-mode") uci:commit("gluon-config-mode")
hostname = uci:get_first("system", "system", "hostname")
if nixio.fork() ~= 0 then 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 else
debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null')) debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null'))
io.stdout:close() io.stdout:close()
......
...@@ -15,7 +15,7 @@ $Id$ ...@@ -15,7 +15,7 @@ $Id$
<html> <html>
<head> <head>
<title><%=luci.sys.hostname()%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %></title> <title><%=hostname%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %></title>
<link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" /> <link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" />
</head> </head>
<body> <body>
...@@ -28,7 +28,7 @@ $Id$ ...@@ -28,7 +28,7 @@ $Id$
@config_mode.msg_pubkey@ @config_mode.msg_pubkey@
</p> </p>
<div class="the-key"> <div class="the-key">
# <%=luci.sys.hostname()%> # <%=hostname%>
<br/> <br/>
<%=pubkey%> <%=pubkey%>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment