diff options
author | Andreas Brodmann <andreas.brodmann@gmail.com> | 2007-11-11 22:05:36 +0000 |
---|---|---|
committer | Andreas Brodmann <andreas.brodmann@gmail.com> | 2007-11-11 22:05:36 +0000 |
commit | dbb4b6f18d32336831bb24ef05b41f638ef3cb79 (patch) | |
tree | 4159600d514a586ec6419c2ad02c2562eaa8323a /dhcp-controller.lua | |
parent | a89179e4edb46e12d51d8a944a770f632496914b (diff) | |
download | acf-dhcp-dbb4b6f18d32336831bb24ef05b41f638ef3cb79.tar.bz2 acf-dhcp-dbb4b6f18d32336831bb24ef05b41f638ef3cb79.tar.xz |
Added dependancy check to dhcp (config dir, daemon and init scripts checked)
git-svn-id: svn://svn.alpinelinux.org/acf/dhcp/trunk@294 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'dhcp-controller.lua')
-rw-r--r-- | dhcp-controller.lua | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/dhcp-controller.lua b/dhcp-controller.lua index 9857fa4..0542150 100644 --- a/dhcp-controller.lua +++ b/dhcp-controller.lua @@ -33,6 +33,22 @@ mvc.post_exec = function ( self ) return pvt.parent_on_exec() end +dep = function ( self ) + + -- do the dependancy check + msg = self.model.dep_check() + + -- make sure nobody accidentally calls this action + if msg == nil then + self.conf.type = "redir" + self.conf.action = "home" + error (self.conf) + end + + -- go ahead + return ( cfe ({ msg = msg }) ) +end + editnet = function ( self ) if not self.clientdata.cmd then @@ -88,12 +104,26 @@ createnet = function ( self ) tmp.gateway, tmp.domainname, tmp.dnssrv1, tmp.dnssrv2, tmp.subnet, tmp.netmask, tmp.leaserangestart, tmp.leaserangeend, tmp.wpad ) errcode, net = self.model.subnet_create( net ) - return ( cfe({ option = option, value = net, errcode = errcode }) ) + if #errcode.msg == 0 then + self.conf.type = "redir" + self.conf.action = "home" + error (self.conf) + else + return ( cfe({ option = option, value = net, errcode = errcode }) ) + end end end home = function ( self ) + -- dependancy check for neccessary libs/packages et al. + msg = self.model.dep_check() + if msg ~= nil then + self.conf.type = "redir" + self.conf.action = "dep" + error(self.conf) + end + local srvctrl = "" if self.clientdata.srvcmd then srvcmd = self.clientdata.srvcmd |