* Completed Firmware-Upgrade page
authorSteven Barth <steven@midlink.org>
Tue, 8 Apr 2008 19:15:11 +0000 (19:15 +0000)
committerSteven Barth <steven@midlink.org>
Tue, 8 Apr 2008 19:15:11 +0000 (19:15 +0000)
* Added Dnsmasq configuration page

contrib/uci/luci
src/ffluci/controller/admin/system.lua
src/ffluci/model/cbi/admin_services/dnsmasq.lua [new file with mode: 0644]
src/ffluci/model/menu/00main.lua
src/ffluci/sys.lua
src/ffluci/view/admin_system/upgrade.htm

index 46795cb..9196d80 100644 (file)
@@ -5,8 +5,14 @@ config core main
 config core category_privileges
                option public nobody:nogroup
                
 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
 
 config public contact
                option nickname
index 102ce99..b0763d8 100644 (file)
@@ -5,6 +5,7 @@ require("ffluci.http")
 require("ffluci.util")
 require("ffluci.fs")
 require("ffluci.model.ipkg")
 require("ffluci.util")
 require("ffluci.fs")
 require("ffluci.model.ipkg")
+require("ffluci.model.uci")
 
 function action_editor()
        local file = ffluci.http.formvalue("file", "")
 
 function action_editor()
        local file = ffluci.http.formvalue("file", "")
@@ -176,5 +177,26 @@ function action_sshkeys()
 end
 
 function action_upgrade()
 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
\ No newline at end of file
 end
\ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_services/dnsmasq.lua b/src/ffluci/model/cbi/admin_services/dnsmasq.lua
new file mode 100644 (file)
index 0000000..4dea322
--- /dev/null
@@ -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
\ No newline at end of file
index d1c535f..0877b8f 100644 (file)
@@ -12,12 +12,14 @@ act("packages", "Paketverwaltung")
 act("passwd", "Passwort ändern")
 act("sshkeys", "SSH-Schlüssel")
 act("fstab", "Einhängepunkte")
 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("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")
 
 add("admin", "network", "Netzwerk", 40)
 act("vlan", "Switch")
index 367d41e..d8fbaa5 100644 (file)
@@ -52,6 +52,17 @@ function execl(command)
        return data
 end
 
        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")()
 -- Returns the hostname
 function hostname()
        return io.lines("/proc/sys/kernel/hostname")()
index e7a8f2f..d91d169 100644 (file)
@@ -2,7 +2,7 @@
 <h1><%:system System%></h1>
 <h2><%:upgrade Upgrade%></h2>
 <br />
 <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">
 <form method="post" action="<%=controller%>-upload/admin/system/upgrade" enctype="multipart/form-data">
        <fieldset class="cbi-section-node">
                <div class="cbi-value clear">
                </div>
        </fieldset>
 </form>
                </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 %>
 <% 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%>
\ No newline at end of file
 <% end %>
 <%+footer%>
\ No newline at end of file