Skip to content
Browse files

Make the DM setting optional

  • Loading branch information...
1 parent 64a4457 commit eada278f72e49446d9896f19266b28c0f7d3d2e9 @krobertson committed Jul 5, 2012
Showing with 5 additions and 6 deletions.
  1. +2 −1 usr/sbin/xe-set-hostname
  2. +3 −5 usr/sbin/xe-set-network
View
3 usr/sbin/xe-set-hostname
@@ -13,8 +13,9 @@ if [ -e $XENSTOREREAD ]; then
# read passed in IP address if it exists
IP=`$XENSTOREREAD vm-data/ip`
+
# otherwise just use the ip address that the machine has already
- if [ $IP = "" ]; then IP=`ip addr list eth0 |grep "inet " |cut -d' ' -f6|cut -d/ -f1`; fi
+ if [ $IP = "" ]; then IP=`ip addr list eth0 | grep "inet " | cut -d' ' -f6 | cut -d/ -f1`; fi
cat << EOF > /etc/hosts
127.0.0.1 localhost
View
8 usr/sbin/xe-set-network
@@ -13,7 +13,6 @@ DM=`$XENSTOREREAD vm-data/dm`
[ "$GW" = "" ] && exit 0
[ "$NM" = "" ] && exit 0
[ "$NS" = "" ] && exit 0
-[ "$DM" = "" ] && exit 0
cat << EOF > /etc/network/interfaces
auto lo
@@ -25,12 +24,11 @@ iface eth0 inet static
netmask $NM
gateway $GW
dns-nameservers $NS
- dns-search $DM
EOF
-# update hosts
-# host file is altered in xe-set-hostanme now
-#env HOSTNAME=`hostname -s` IP=$IP perl -pi -e 's/^(\d+\.\d+\.\d+\.\d+)(\s+$ENV{HOSTNAME})/$ENV{IP}$2/' /etc/hosts
+if [ ! "$DM" = "" ]; then
+ echo " dns-search $DM" >> /etc/network/interfaces
+fi
/etc/init.d/networking restart

0 comments on commit eada278

Please sign in to comment.
Something went wrong with that request. Please try again.