* Completed Firmware-Upgrade page

* Added Dnsmasq configuration page
This commit is contained in:
Steven Barth 2008-04-08 19:15:11 +00:00
parent f341dfe91a
commit 30ca47c27a
6 changed files with 71 additions and 5 deletions

View file

@ -5,8 +5,14 @@ config core main
config core category_privileges
option public nobody:nogroup
config extern flash
option keep "/etc/config /etc/dropbear /etc/openvpn /etc/passwd /etc/ipkg.conf /etc/httpd.conf /etc/firewall.user"
config extern flash_keep
option uci "/etc/config"
option dropbear "/etc/dropbear"
option openvpn "/etc/openvpn"
option passwd "/etc/passwd"
option ipkg "/etc/ipkg.conf"
option httpd "/etc/httpd.conf"
option firewall "/etc/firewall.user"
config public contact
option nickname

View file

@ -5,6 +5,7 @@ require("ffluci.http")
require("ffluci.util")
require("ffluci.fs")
require("ffluci.model.ipkg")
require("ffluci.model.uci")
function action_editor()
local file = ffluci.http.formvalue("file", "")
@ -176,5 +177,26 @@ function action_sshkeys()
end
function action_upgrade()
-- To be implemented
local ret = nil
local plat = ffluci.fs.mtime("/lib/upgrade/platform.sh")
local image = ffluci.http.formvalue("image")
local imgname = ffluci.http.formvalue("image_name")
local keepcfg = ffluci.http.formvalue("keepcfg")
if plat and imgname then
local kpattern = nil
if keepcfg then
local files = ffluci.model.uci.show("luci", "flash_keep")
if files.luci and files.luci.flash_keep then
kpattern = ""
for k,v in pairs(files.luci.flash_keep) do
kpattern = kpattern .. " " .. v
end
end
end
ret = ffluci.sys.flash(image, kpattern)
end
ffluci.template.render("admin_system/upgrade", {sysupgrade=plat, ret=ret})
end

View file

@ -0,0 +1,19 @@
m = Map("dhcp", "Dnsmasq")
s = m:section(TypedSection, "dnsmasq", "Einstellungen")
s.anonymous = true
s:option(Flag, "domainneeded", "Anfragen nur mit Domain", "Anfragen ohne Domainnamen nicht weiterleiten")
s:option(Flag, "authoritative", "Authoritativ", "Dies ist der einzige DHCP im lokalen Netz")
s:option(Flag, "boguspriv", "Private Anfragen filtern", "Reverse DNS-Anfragen für lokalen Netze nicht weiterleiten")
s:option(Flag, "filterwin2k", "Windowsanfragen filtern", "nutzlose DNS-Anfragen aktueller Windowssysteme filtern")
s:option(Flag, "localise", "Lokalisiere Anfragen", "Gibt die Adresse eines Hostnamen entsprechend seines Subnetzes zurück")
s:option(Value, "local", "Lokale Server")
s:option(Value, "domain", "Lokale Domain")
s:option(Flag, "expand_hosts", "Erweitere Hosts", "Fügt Domainnamen zu einfachen Hosteinträgen in der Resolvdatei hinzu")
s:option(Flag, "nonegcache", "Unbekannte nicht cachen", "Negative DNS-Antworten nicht zwischenspeichern")
s:option(Flag, "readethers", "Verwende /etc/ethers", "Lese Informationen aus /etc/ethers um den DHCP-Server zu konfigurieren")
s:option(Value, "leasefile", "Leasedatei", "Speicherort für vergebenen DHCP-Adressen")
s:option(Value, "resolvfile", "Resolvdatei", "Lokale DNS-Datei")
return m

View file

@ -12,12 +12,14 @@ act("packages", "Paketverwaltung")
act("passwd", "Passwort ändern")
act("sshkeys", "SSH-Schlüssel")
act("fstab", "Einhängepunkte")
act("upgrade", "Firmwareupgrade")
act("reboot", "Neu starten")
add("admin", "services", "Dienste", 30)
act("olsrd", "OLSR")
act("httpd", "HTTP-Server")
act("dropbear", "SSH-Server")
act("dnsmasq", "Dnsmasq")
add("admin", "network", "Netzwerk", 40)
act("vlan", "Switch")

View file

@ -52,6 +52,17 @@ function execl(command)
return data
end
-- Uses "ffluci-flash" to flash a new image file to the system
function flash(image, kpattern)
local cmd = "ffluci-flash "
if kpattern then
cmd = cmd .. "-k '" .. kapttern:gsub("'", "") .. "' "
end
cmd = cmd .. "'" .. image:gsub("'", "") .. "'"
return os.execute(cmd)
end
-- Returns the hostname
function hostname()
return io.lines("/proc/sys/kernel/hostname")()

View file

@ -2,7 +2,7 @@
<h1><%:system System%></h1>
<h2><%:upgrade Upgrade%></h2>
<br />
<% if sysupgrade then %>
<% if sysupgrade and not ret then %>
<form method="post" action="<%=controller%>-upload/admin/system/upgrade" enctype="multipart/form-data">
<fieldset class="cbi-section-node">
<div class="cbi-value clear">
@ -20,7 +20,13 @@
</div>
</fieldset>
</form>
<% elseif ret then %>
<% if ret == 0 then %>
<div class="ok"><%:flashed Flashvorgang erfolgreich. Router startet neu...%></div>
<% else %>
<div class="error"><%:flasherr Flashvorgang fehlgeschlagen!%> (<%:code Code%> <%=ret%>)</div>
<% end %>
<% else %>
<div class="error"><%:notimplemented Diese Funktion ist leider (noch) nicht eingebaut.%></div>
<div class="error"><%:notimplemented Diese Funktion steht leider (noch) nicht zur Verfügung.%></div>
<% end %>
<%+footer%>