CLOUDSTACK-7143: move networking logic from postinstall.sh to configure_networking.sh

This commit is contained in:
Leo Simons 2014-07-21 11:41:37 +02:00 committed by Rohit Yadav
parent 3574dcf543
commit a533de7593
3 changed files with 24 additions and 21 deletions

View File

@ -1,2 +1,25 @@
HOSTNAME=systemvm
echo "Adding a 2 sec delay to the interface up, to make the dhclient happy"
echo "pre-up sleep 2" >> /etc/network/interfaces
fix_nameserver() {
# Replace /etc/resolv.conf also
cat > /etc/resolv.conf << EOF
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
}
fix_hostname() {
# Fix hostname in openssh-server generated keys
sed -i "s/root@\(.*\)$/root@$HOSTNAME/g" /etc/ssh/ssh_host_*.pub
# Fix hostname to override one provided by dhcp during vm build
echo "$HOSTNAME" > /etc/hostname
hostname $HOSTNAME
# Delete entry in /etc/hosts derived from dhcp
sed -i '/127.0.1.1/d' /etc/hosts
}
fix_hostname
fix_nameserver

View File

@ -62,11 +62,11 @@ config = {
'configure_grub.sh',
'configure_locale.sh',
'configure_login.sh',
'configure_networking.sh',
'postinstall.sh',
'configure_acpid.sh',
'configure_conntrack.sh',
'cleanup.sh',
'configure_networking.sh',
'zerodisk.sh'
],
:postinstall_timeout => '10000'

View File

@ -108,32 +108,12 @@ install_packages() {
apt-get --no-install-recommends -q -y --force-yes install radvd
}
fix_nameserver() {
# Replace /etc/resolv.conf also
cat > /etc/resolv.conf << EOF
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
}
fix_hostname() {
# Fix hostname in openssh-server generated keys
sed -i "s/root@\(.*\)$/root@$HOSTNAME/g" /etc/ssh/ssh_host_*.pub
# Fix hostname to override one provided by dhcp during vm build
echo "$HOSTNAME" > /etc/hostname
hostname $HOSTNAME
# Delete entry in /etc/hosts derived from dhcp
sed -i '/127.0.1.1/d' /etc/hosts
}
fix_vhdutil() {
wget --no-check-certificate http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -O /bin/vhd-util
chmod a+x /bin/vhd-util
}
do_fixes() {
fix_nameserver
fix_hostname
fix_vhdutil
}