Skip to content

Commit

Permalink
* add scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyxu committed Dec 2, 2013
1 parent 53d4bf4 commit fa2e6bf
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
18 changes: 18 additions & 0 deletions templates/scripts/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Clean up unneeded packages.
#yum -y erase gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts
yum -y clean all

# Ensure that udev doesn't screw us with network device naming.
ln -sf /dev/null /lib/udev/rules.d/75-persistent-net-generator.rules
rm -f /etc/udev/rules.d/70-persistent-net.rules

# On startup, remove HWADDR from the eth0 interface.
cp -f /etc/sysconfig/network-scripts/ifcfg-eth0 /tmp/eth0
sed "/^HWADDR/d" /tmp/eth0 > /etc/sysconfig/network-scripts/ifcfg-eth0
sed -e "s/dhcp/none/;s/eth0/eth1/" /etc/sysconfig/network-scripts/ifcfg-eth0 > /etc/sysconfig/network-scripts/ifcfg-eth1

# Prevent way too much CPU usage in VirtualBox by disabling APIC.
sed -e 's/\tkernel.*/& noapic/' /boot/grub/grub.conf > /tmp/new_grub.conf
mv /boot/grub/grub.conf /boot/grub/grub.conf.bak
mv /tmp/new_grub.conf /boot/grub/grub.conf

11 changes: 11 additions & 0 deletions templates/scripts/vagrant.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Vagrant specific
date > /etc/vagrant_box_build_time

# Installing vagrant keys
mkdir -pm 700 /home/vagrant/.ssh
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh

# Customize the message of the day
echo 'Welcome to your Vagrant-built virtual machine.' > /etc/motd
10 changes: 10 additions & 0 deletions templates/scripts/virtualbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Bail if we are not running inside VirtualBox.
[ `facter virtual` == "virtualbox" ] || {
exit 0
}

mkdir -p /mnt/virtualbox
mount -o loop /home/vagrant/VBoxGuest*.iso /mnt/virtualbox
sh /mnt/virtualbox/VBoxLinuxAdditions.run
umount /mnt/virtualbox
rm -rf /home/vagrant/VBoxGuest*.iso
8 changes: 8 additions & 0 deletions templates/scripts/zerodisk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Zero out the free space to save space in the final image:
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY

# Sync to ensure that the delete completes before this moves on.
sync
sync
sync

0 comments on commit fa2e6bf

Please sign in to comment.