diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2008-07-15 13:50:54 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2008-07-15 13:50:54 +0000 |
commit | 157606fbc3d73c70bd52abebc3867fe52b410db2 (patch) | |
tree | 687983cd6297850dde34aafdea79c912a755e987 /contrib/package | |
parent | 012af10360aba063b96d34c3af81c1d50a8d3579 (diff) |
* luci/addons: add initscript for generating /etc/ethers on boot
Diffstat (limited to 'contrib/package')
-rw-r--r-- | contrib/package/luci-addons/Makefile | 5 | ||||
-rw-r--r-- | contrib/package/luci-addons/dist/etc/init.d/luci_ethers | 26 | ||||
-rw-r--r-- | contrib/package/luci-addons/dist/etc/init.d/luci_fixtime (renamed from contrib/package/luci-addons/dist/etc/init.d/luci-fixtime) | 0 |
3 files changed, 29 insertions, 2 deletions
diff --git a/contrib/package/luci-addons/Makefile b/contrib/package/luci-addons/Makefile index 27d214d2f..8b195fd66 100644 --- a/contrib/package/luci-addons/Makefile +++ b/contrib/package/luci-addons/Makefile @@ -30,8 +30,9 @@ define Package/luci-addons/install $(INSTALL_BIN) ./dist/usr/bin/run-parts $(1)/usr/bin $(INSTALL_BIN) ./dist/sbin/luci-flash $(1)/sbin - $(INSTALL_BIN) ./dist/etc/init.d/luci-fixtime $(1)/etc/init.d - + $(INSTALL_BIN) ./dist/etc/init.d/luci_fixtime $(1)/etc/init.d + $(INSTALL_BIN) ./dist/etc/init.d/luci_ethers $(1)/etc/init.d + $(CP) ./dist/etc/crontabs/root $(1)/etc/crontabs/root $(CP) ./dist/etc/hotplug.d/iface/20-aliases $(1)/etc/hotplug.d/iface/20-aliases endef diff --git a/contrib/package/luci-addons/dist/etc/init.d/luci_ethers b/contrib/package/luci-addons/dist/etc/init.d/luci_ethers new file mode 100644 index 000000000..e0f2470ad --- /dev/null +++ b/contrib/package/luci-addons/dist/etc/init.d/luci_ethers @@ -0,0 +1,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 +} diff --git a/contrib/package/luci-addons/dist/etc/init.d/luci-fixtime b/contrib/package/luci-addons/dist/etc/init.d/luci_fixtime index 3ca003887..3ca003887 100644 --- a/contrib/package/luci-addons/dist/etc/init.d/luci-fixtime +++ b/contrib/package/luci-addons/dist/etc/init.d/luci_fixtime |