Permalink
Browse files

Merge pull request #56 from mdxp/master

Debian template improvement: smaller size and correct version of VBoxGuestAdditions installed
  • Loading branch information...
2 parents 7312148 + 7329c43 commit 4fa280d05490f10ecf27edcaa1670d334fb73ea8 @jedi4ever jedi4ever committed Jun 29, 2011
@@ -30,8 +30,9 @@ wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys
chown -R vagrant /home/vagrant/.ssh
#the netboot install the virtualbox stuff so we have to remove it
-apt-get -y remove virtualbox-ose-guest-dkms
-apt-get -y remove virtualbox-ose-guest-utils
+/etc/init.d/virtualbox-ose-guest-utils stop
+rmmod vboxguest
+aptitude -y purge virtualbox-ose-guest-x11 virtualbox-ose-guest-dkms virtualbox-ose-guest-utils
#Installing the virtualbox guest additions
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
@@ -45,4 +46,23 @@ apt-get -y remove linux-headers-$(uname -r) build-essential
apt-get -y autoremove
rm VBoxGuestAdditions_$VBOX_VERSION.iso
+
+# Zero out the free space to save space in the final image:
+dd if=/dev/zero of=/EMPTY bs=1M
+rm -f /EMPTY
+
+# Removing leftover leases and persistent rules
+echo "cleaning up dhcp leases"
+rm /var/lib/dhcp3/*
+
+# Make sure Udev doesn't block our network
+# http://6.ptmc.org/?p=164
+echo "cleaning up udev rules"
+rm /etc/udev/rules.d/70-persistent-net.rules
+mkdir /etc/udev/rules.d/70-persistent-net.rules
+rm -rf /dev/.udev/
+rm /lib/udev/rules.d/75-persistent-net-generator.rules
+
+echo "Adding a 2 sec delay to the interface up, to make the dhclient happy"
+echo "pre-up sleep 2" >> /etc/network/interfaces
exit
@@ -42,8 +42,9 @@ echo 'UseDNS no' >> /etc/ssh/sshd_config
echo 'Welcome to your Vagrant-built virtual machine.' > /var/run/motd
# The netboot installs the VirtualBox support (old) so we have to remove it
-apt-get -y remove virtualbox-ose-guest-dkms
-apt-get -y remove virtualbox-ose-guest-utils
+/etc/init.d/virtualbox-ose-guest-utils stop
+rmmod vboxguest
+aptitude -y purge virtualbox-ose-guest-x11 virtualbox-ose-guest-dkms virtualbox-ose-guest-utils
# Install the VirtualBox guest additions
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
@@ -58,4 +59,23 @@ apt-get -y remove linux-headers-$(uname -r) build-essential
apt-get -y autoremove
rm /tmp/VBoxGuestAdditions_$VBOX_VERSION.iso
+
+# Zero out the free space to save space in the final image:
+dd if=/dev/zero of=/EMPTY bs=1M
+rm -f /EMPTY
+
+# Removing leftover leases and persistent rules
+echo "cleaning up dhcp leases"
+rm /var/lib/dhcp3/*
+
+# Make sure Udev doesn't block our network
+# http://6.ptmc.org/?p=164
+echo "cleaning up udev rules"
+rm /etc/udev/rules.d/70-persistent-net.rules
+mkdir /etc/udev/rules.d/70-persistent-net.rules
+rm -rf /dev/.udev/
+rm /lib/udev/rules.d/75-persistent-net-generator.rules
+
+echo "Adding a 2 sec delay to the interface up, to make the dhclient happy"
+echo "pre-up sleep 2" >> /etc/network/interfaces
exit

0 comments on commit 4fa280d

Please sign in to comment.