1 #!/bin/sh /etc/rc.common
7 config_get hostname "$cfg" hostname
8 config_get ipaddr "$cfg" ipaddr
10 [ -n "$hostname" -a -n "$ipaddr" ] || return 0
12 echo "$ipaddr $hostname" >> /var/etc/hosts
16 if [ ! -L /etc/hosts ]; then
17 test -f /etc/hosts && mv /etc/hosts /etc/hosts.local
18 ln -s /var/etc/hosts /etc/hosts
21 echo "# This file is autogenerated, use /etc/hosts.local instead" > /var/etc/hosts
23 test -d /var/etc || mkdir -p /var/etc
24 test -f /etc/hosts.local && cat /etc/hosts.local >> /var/etc/hosts
26 config_load luci_hosts
27 config_foreach apply_host host
33 test -f /var/etc/hosts && rm -f /var/etc/hosts