blob: e0f2470ade60ef1de19e5285c438cdfadc1ca4ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/bin/sh /etc/rc.common
START=59
apply_lease() {
local cfg="$1"
config_get macaddr "$cfg" macaddr
config_get ipaddr "$cfg" ipaddr
[ -n "$macaddr" -a -n "$ipaddr" ] || return 0
echo "$macaddr $ipaddr" >> /var/etc/ethers
}
start() {
if [ ! -L /etc/ethers ]; then
test -f /etc/ethers && mv /etc/ethers /etc/ethers.local
test -d /var/etc || mkdir -p /var/etc
ln -s /var/etc/ethers /etc/ethers
fi
config_load luci_ethers
config_foreach apply_lease static_lease
test -f /etc/ethers.local && cat /etc/ethers.local >> /var/etc/ethers
}
|