Browse code

clean up setting of hostname

Anthony Young authored on 2011/10/28 05:06:39
Showing 1 changed files
... ...
@@ -166,22 +166,6 @@ cp $FILES_DIR/hvc0.conf $STAGING_DIR/etc/init/
166 166
 # Put the VPX into UTC.
167 167
 rm -f $STAGING_DIR/etc/localtime
168 168
 
169
-# Helper to set hostname
170
-function set_hostname() {
171
-    echo $1 > $STAGING_DIR/etc/hostname
172
-}
173
-
174
-# We need a resolvable host name for rabbit to launch
175
-if ! grep -q $GUEST_NAME $STAGING_DIR/etc/hosts; then
176
-    echo "$MGT_IP $GUEST_NAME" >> $STAGING_DIR/etc/hosts
177
-fi
178
-
179
-# Configure hosts file
180
-cat <<EOF >$STAGING_DIR/etc/hosts
181
-$MGT_IP $GUEST_NAME
182
-127.0.0.1 localhost localhost.localdomain
183
-EOF
184
-
185 169
 # Configure dns (use same dns as dom0)
186 170
 cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf
187 171
 
... ...
@@ -260,8 +244,16 @@ fi
260 260
 # Clean old xva. In the future may not do this every time.
261 261
 rm -f $XVA
262 262
 
263
+# Configure the hostname
264
+echo $GUEST_NAME > $STAGING_DIR/etc/hostname
265
+
266
+# Hostname must resolve for rabbit
267
+cat <<EOF >$STAGING_DIR/etc/hosts
268
+$MGT_IP $GUEST_NAME
269
+127.0.0.1 localhost localhost.localdomain
270
+EOF
271
+
263 272
 # Configure the network
264
-set_hostname $GUEST_NAME
265 273
 INTERFACES=$STAGING_DIR/etc/network/interfaces
266 274
 cp $TEMPLATES_DIR/interfaces.in  $INTERFACES
267 275
 sed -e "s,@ETH1_IP@,$VM_IP,g" -i $INTERFACES