summaryrefslogtreecommitdiffstats
path: root/setup-interfaces.in
diff options
context:
space:
mode:
Diffstat (limited to 'setup-interfaces.in')
-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