Created
May 24, 2016 14:51
-
-
Save imduffy15/50d276cb4639c4d2958457bacf5006f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eux | |
# set a default HOME_DIR environment variable if not set | |
HOME_DIR="${HOME_DIR:-/root}"; | |
case "$PACKER_BUILDER_TYPE" in | |
virtualbox-iso|virtualbox-ovf) | |
yum -y install autoconf bison flex gcc gcc-c++ kernel-devel-$(uname -r) kernel-headers-$(uname -r) m4 patch perl | |
mkdir -p /tmp/vbox; | |
mount -o loop $HOME_DIR/VBoxGuestAdditions.iso /tmp/vbox; | |
sh /tmp/vbox/VBoxLinuxAdditions.run \ | |
|| echo "VBoxLinuxAdditions.run exited $? and is suppressed." \ | |
"For more read https://www.virtualbox.org/ticket/12479"; | |
umount /tmp/vbox; | |
rm -rf /tmp/vbox; | |
rm -f $HOME_DIR/*.iso; | |
;; | |
vmware-iso|vmware-vmx) | |
yum -y install autoconf bison flex gcc gcc-c++ kernel-devel-$(uname -r) kernel-headers-$(uname -r) m4 patch perl | |
mkdir -p /tmp/vmfusion; | |
mkdir -p /tmp/vmfusion-archive; | |
mount -o loop $HOME_DIR/linux.iso /tmp/vmfusion; | |
tar xzf /tmp/vmfusion/VMwareTools-*.tar.gz -C /tmp/vmfusion-archive; | |
perl /tmp/vmfusion-archive/vmware-tools-distrib/vmware-install.pl --default --force-install; | |
umount /tmp/vmfusion; | |
rm -rf /tmp/vmfusion; | |
rm -rf /tmp/vmfusion-archive; | |
rm -f $HOME_DIR/*.iso; | |
;; | |
parallels-iso|parallels-pvm) | |
yum -y install autoconf bison flex gcc gcc-c++ kernel-devel-$(uname -r) kernel-headers-$(uname -r) m4 patch perl | |
mkdir -p /tmp/parallels; | |
mount -o loop $HOME_DIR/prl-tools-lin.iso /tmp/parallels; | |
/tmp/parallels/install --install-unattended-with-deps \ | |
|| (code="$?"; \ | |
echo "Parallels tools installation exited $code, attempting" \ | |
"to output /var/log/parallels-tools-install.log"; \ | |
cat /var/log/parallels-tools-install.log; \ | |
exit $code); | |
umount /tmp/parallels; | |
rm -rf /tmp/parallels; | |
rm -f $HOME_DIR/*.iso; | |
;; | |
qemu) | |
grubby --update-kernel=ALL --args="console=tty0 console=ttyS0,115200n8 console=tty0" | |
echo ttyS0 >> /etc/securetty | |
sed -i 's@ACTIVE_CONSOLES=/dev/tty\[1-6\]@ACTIVE_CONSOLES="/dev/tty\[1-6\] /dev/ttyS0"@g' /etc/sysconfig/init | |
;; | |
*) | |
echo "Unknown Packer Builder Type >>$PACKER_BUILDER_TYPE<< selected."; | |
echo "Known are virtualbox-iso|virtualbox-ovf|vmware-iso|vmware-vmx|parallels-iso|parallels-pvm|qemu."; | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment