luci-0.9: merge r5777
This commit is contained in:
parent
b30715381e
commit
c146ab202d
1 changed files with 41 additions and 0 deletions
41
modules/admin-core/root/etc/init.d/luci_dhcp_migrate
Executable file
41
modules/admin-core/root/etc/init.d/luci_dhcp_migrate
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=59
|
||||
|
||||
boot() {
|
||||
if [ -f /etc/config/luci_ethers ]; then
|
||||
logger -t luci_dhcp_migrate "Migrating luci_ethers configuration ..."
|
||||
|
||||
lua -lluci.model.uci -e '
|
||||
x=luci.model.uci.cursor()
|
||||
x:foreach("luci_ethers", "static_lease",
|
||||
function(s)
|
||||
x:section("dhcp", "host", nil, {mac=s.macaddr, ip=s.ipaddr})
|
||||
end)
|
||||
x:save("dhcp")
|
||||
x:commit("dhcp")
|
||||
'
|
||||
|
||||
rm -f /etc/config/luci_ethers
|
||||
fi
|
||||
|
||||
if [ -f /etc/config/luci_hosts ]; then
|
||||
logger -t luci_dhcp_migrate "Migrating luci_hosts configuration ..."
|
||||
|
||||
lua -lluci.model.uci -e '
|
||||
x=luci.model.uci.cursor()
|
||||
x:foreach("luci_hosts", "host",
|
||||
function(s)
|
||||
x:section("dhcp", "domain", nil, {name=s.hostname, ip=s.ipaddr})
|
||||
end)
|
||||
x:save("dhcp")
|
||||
x:commit("dhcp")
|
||||
'
|
||||
|
||||
rm -f /etc/config/luci_hosts
|
||||
fi
|
||||
}
|
||||
|
||||
start() { :; }
|
||||
stop() { :; }
|
||||
|
Loading…
Reference in a new issue