summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Brodmann <andreas.brodmann@gmail.com>2008-03-05 13:11:42 +0000
committerAndreas Brodmann <andreas.brodmann@gmail.com>2008-03-05 13:11:42 +0000
commit1af8d04a69cb46bbebfb77a39e14e1c4978a7749 (patch)
tree479d0dec4d72d54a5fafd6e427b9559bafe227ff
parent0ac0cd4bda4cda5de8a995e2d5715df257929c16 (diff)
downloadacf-dhcp-1af8d04a69cb46bbebfb77a39e14e1c4978a7749.tar.bz2
acf-dhcp-1af8d04a69cb46bbebfb77a39e14e1c4978a7749.tar.xz
cleaned up generation for the first releasev0.3
git-svn-id: svn://svn.alpinelinux.org/acf/dhcp/trunk@819 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--dhcp-controller.lua4
-rw-r--r--dhcp-editnet-html.lsp6
-rw-r--r--dhcp-editspc-html.lsp8
-rw-r--r--dhcp-model.lua16
4 files changed, 32 insertions, 2 deletions
diff --git a/dhcp-controller.lua b/dhcp-controller.lua
index 5c7e6e4..cf9d307 100644
--- a/dhcp-controller.lua
+++ b/dhcp-controller.lua
@@ -112,6 +112,10 @@ editnet = function ( self )
if not self.clientdata.cmd then
list_redir(self)
+ else
+ if self.clientdata.cmd == "back" then
+ list_redir(self)
+ end
end
local net = {}
diff --git a/dhcp-editnet-html.lsp b/dhcp-editnet-html.lsp
index 9adfe2f..35bfac6 100644
--- a/dhcp-editnet-html.lsp
+++ b/dhcp-editnet-html.lsp
@@ -86,5 +86,11 @@
<dd><input type="submit" name="cmd" value="update" class="submit"></dd>
<dt>Cancel and go back</dt><dd><input type=submit name="cmd" value="back" class="submit"></form></dd>
</DL>
+
+<h2>Static Hosts</h2>
+<p>
+Enter static hosts data, one per line <i>(e.g. hostname;192.168.xx.140;00:11:22:33:44:55;comment)</i>
+</p>
+<textarea name="statichosts"><? io.write( net.statichosts.value ) ?></textarea>
</form>
diff --git a/dhcp-editspc-html.lsp b/dhcp-editspc-html.lsp
index 166eeef..e06d045 100644
--- a/dhcp-editspc-html.lsp
+++ b/dhcp-editspc-html.lsp
@@ -11,11 +11,16 @@
<pre style="color: #ff2020;"><? io.write( form.errcode.msg ) ?></pre>
<h2>DHCPd - Dynamic Hosts</h2>
+<p>
+Enter dynamic hosts data, one per line <i>(e.g. hostname;00:11:22:33:44:55)</i>
+</p>
<textarea name="dynamic"><? io.write( form.value.dynamic ) ?></textarea>
<h2>DHCPd - Pre Main Configuration</h2>
+<p>
These fields below are copied into the final dhcpd.conf on configuration generation without any validation check. Do not use
them unless you know what you are doing.
+</p>
<textarea name="preconfig"><? io.write(form.value.preconfig) ?></textarea>
<h2>DHCPd - Post Main Configuration</h2>
@@ -26,11 +31,10 @@ them unless you know what you are doing.
<dt>Submit above settings</dt>
<dd><input type="submit" name="cmd" value="update" class="submit"></dd>
-</form>
-
<dt>Cancel and go back</dt>
<dd><form action="<? io.write(option.script .. option.prefix .. option.controller .. "/home") ?>" method="POST">
<input type=submit name="cmd" value="back" class="submit"></form></dd>
+</form>
</DL>
diff --git a/dhcp-model.lua b/dhcp-model.lua
index 9709e0a..4ea2afd 100644
--- a/dhcp-model.lua
+++ b/dhcp-model.lua
@@ -203,6 +203,22 @@ config_generate = function()
tmpfile:close()
os.rename( tmpfilename, "/etc/dhcp/dhcpd.conf" )
+ -- make sure the master pre/post config files are present
+ local precfg
+ local postcfg
+ precfg = io.open( "/etc/dhcp/dhcpd.preconfig", "r" )
+ postcfg = io.open( "/etc/dhcp/dhcpd.postconfig", "r" )
+
+ if precfg == nil then
+ precfg = io.open( "/etc/dhcp/dhcpd.preconfig", "w+" )
+ end
+ precfg:close()
+
+ if postcfg == nil then
+ postcfg = io.open( "/etc/dhcp/dhcpd.postconfig", "w+" )
+ end
+ postcfg:close()
+
return "Configuration Generation Successful!\n"
end