diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-02-01 17:08:40 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-02-01 17:08:40 +0000 |
commit | 4b9f7db1cea69524ca46098b446b0fe51e87091b (patch) | |
tree | 13b2078e06fa466c76aaf09ca7c7320733f8f5f1 /modules/admin-full/luasrc | |
parent | d7d27ffe6adfb42be253bf2a62e7cc4e209affaf (diff) |
libs/sys: extend luci.sys.hostname() to allow setting a new name
modules/admin-{full,mini}: update the hostname at runtime
Diffstat (limited to 'modules/admin-full/luasrc')
-rw-r--r-- | modules/admin-full/luasrc/model/cbi/admin_system/system.lua | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_system/system.lua b/modules/admin-full/luasrc/model/cbi/admin_system/system.lua index 9820cceb2c..6814680647 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_system/system.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_system/system.lua @@ -28,10 +28,10 @@ s:option(DummyValue, "_system", translate("system")).value = system s:option(DummyValue, "_cpu", translate("m_i_processor")).value = model local load1, load5, load15 = luci.sys.loadavg() -s:option(DummyValue, "_la", translate("load")).value = +s:option(DummyValue, "_la", translate("load")).value = string.format("%.2f, %.2f, %.2f", load1, load5, load15) - -s:option(DummyValue, "_memtotal", translate("m_i_memory")).value = + +s:option(DummyValue, "_memtotal", translate("m_i_memory")).value = string.format("%.2f MB (%.0f%% %s, %.0f%% %s, %.0f%% %s)", tonumber(memtotal) / 1024, 100 * memcached / memtotal, @@ -43,11 +43,17 @@ s:option(DummyValue, "_memtotal", translate("m_i_memory")).value = s:option(DummyValue, "_systime", translate("m_i_systemtime")).value = os.date("%c") - -s:option(DummyValue, "_uptime", translate("m_i_uptime")).value = + +s:option(DummyValue, "_uptime", translate("m_i_uptime")).value = luci.tools.webadmin.date_format(tonumber(uptime)) -s:option(Value, "hostname", translate("hostname")) +hn = s:option(Value, "hostname", translate("hostname")) + +function hn.write(self, section, value) + Value.write(self, section, value) + luci.sys.hostname(value) +end + tz = s:option(ListValue, "zonename", translate("timezone")) tz:value("UTC") |