summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-04-19 14:07:57 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-04-19 14:52:36 +0000
commit223d57a01c8034737bbd8aeeb81f2476f251109d (patch)
treed8d92aae07b21d3ccdb1825922b641837878397d
parenta1712e1174af8b56a8365ad7ee749d8a4a87ddf7 (diff)
downloadalpine-conf-223d57a01c8034737bbd8aeeb81f2476f251109d.zip
setup-interfaces: add hostname to dhcp
for dynamic dns
-rwxr-xr-xsetup-interfaces.in18
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