clean up setting of hostname

This commit is contained in:
Anthony Young 2011-10-27 13:06:39 -07:00
parent ea1290a997
commit 138b283823

View file

@ -166,22 +166,6 @@ cp $FILES_DIR/hvc0.conf $STAGING_DIR/etc/init/
# Put the VPX into UTC. # Put the VPX into UTC.
rm -f $STAGING_DIR/etc/localtime rm -f $STAGING_DIR/etc/localtime
# Helper to set hostname
function set_hostname() {
echo $1 > $STAGING_DIR/etc/hostname
}
# We need a resolvable host name for rabbit to launch
if ! grep -q $GUEST_NAME $STAGING_DIR/etc/hosts; then
echo "$MGT_IP $GUEST_NAME" >> $STAGING_DIR/etc/hosts
fi
# Configure hosts file
cat <<EOF >$STAGING_DIR/etc/hosts
$MGT_IP $GUEST_NAME
127.0.0.1 localhost localhost.localdomain
EOF
# Configure dns (use same dns as dom0) # Configure dns (use same dns as dom0)
cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf
@ -260,8 +244,16 @@ fi
# Clean old xva. In the future may not do this every time. # Clean old xva. In the future may not do this every time.
rm -f $XVA rm -f $XVA
# Configure the hostname
echo $GUEST_NAME > $STAGING_DIR/etc/hostname
# Hostname must resolve for rabbit
cat <<EOF >$STAGING_DIR/etc/hosts
$MGT_IP $GUEST_NAME
127.0.0.1 localhost localhost.localdomain
EOF
# Configure the network # Configure the network
set_hostname $GUEST_NAME
INTERFACES=$STAGING_DIR/etc/network/interfaces INTERFACES=$STAGING_DIR/etc/network/interfaces
cp $TEMPLATES_DIR/interfaces.in $INTERFACES cp $TEMPLATES_DIR/interfaces.in $INTERFACES
sed -e "s,@ETH1_IP@,$VM_IP,g" -i $INTERFACES sed -e "s,@ETH1_IP@,$VM_IP,g" -i $INTERFACES