diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-04-19 14:07:57 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-04-19 14:52:36 +0000 |
commit | 223d57a01c8034737bbd8aeeb81f2476f251109d (patch) | |
tree | d8d92aae07b21d3ccdb1825922b641837878397d | |
parent | a1712e1174af8b56a8365ad7ee749d8a4a87ddf7 (diff) | |
download | alpine-conf-223d57a01c8034737bbd8aeeb81f2476f251109d.zip |
setup-interfaces: add hostname to dhcp
for dynamic dns
-rwxr-xr-x | setup-interfaces.in | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/setup-interfaces.in b/setup-interfaces.in index 1bbac29..e402742 100755 --- a/setup-interfaces.in +++ b/setup-interfaces.in @@ -126,16 +126,26 @@ done echo "type=loopback" > 000~lo.conf echo "" > interface +hostname=$(cat /etc/hostname 2>/dev/null) + for i in *.conf ; do iface=`basename $i .conf` iface=${iface#[0-9]*~} . ./$i echo "auto $iface" >> interfaces echo "iface $iface inet $type" >> interfaces - [ "$type" = "static" ] || continue - echo -e "\taddress $address" >> interfaces - echo -e "\tnetmask $netmask" >> interfaces - [ "$gateway" ] && echo -e "\tgateway $gateway" >> interfaces + case $type in + dhcp) + [ -n "$hostname" ] \ + && echo -e "\thostname $hostname" >> interfaces + ;; + static) + echo -e "\taddress $address" >> interfaces + echo -e "\tnetmask $netmask" >> interfaces + [ "$gateway" ] \ + && echo -e "\tgateway $gateway" >> interfaces + ;; + esac echo "" >> interfaces done |