From: Jo-Philipp Wich Date: Tue, 9 Mar 2010 11:37:54 +0000 (+0000) Subject: luci-0.9: merge r5777 X-Git-Tag: 0.9.0~48 X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=c146ab202d9c13a58a01e5028ea462c0f62e7c69 luci-0.9: merge r5777 --- diff --git a/modules/admin-core/root/etc/init.d/luci_dhcp_migrate b/modules/admin-core/root/etc/init.d/luci_dhcp_migrate new file mode 100755 index 000000000..7fb443527 --- /dev/null +++ b/modules/admin-core/root/etc/init.d/luci_dhcp_migrate @@ -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() { :; } +