packer-arch/scripts/install-virtualbox.sh
Aaron Bull Schaefer d5adbc3f10 Remove duplication in installation scripts
Instead of having mostly duplicate scripts for the entire installation
process, we can split them up into the base installation steps and then
run shell provisioners for anything specific to each of the types after
the machine has rebooted.

This structure will mean less chance of error when making changes to
machines, and will also allow for expansion of the scripts to be run at
the end, such as adding a minimization script to remove history and
clear out space on the drive before compression.
2016-02-08 09:27:41 -08:00

16 lines
778 B
Bash
Executable file

#!/usr/bin/bash -x
# VirtualBox Guest Additions
# https://wiki.archlinux.org/index.php/VirtualBox
/usr/bin/pacman -S --noconfirm linux-headers virtualbox-guest-utils virtualbox-guest-dkms nfs-utils
echo -e 'vboxguest\nvboxsf\nvboxvideo' > /etc/modules-load.d/virtualbox.conf
guest_version=$(/usr/bin/pacman -Q virtualbox-guest-dkms | awk '{ print $2 }' | cut -d'-' -f1)
kernel_version="$(/usr/bin/pacman -Q linux | awk '{ print $2 }')-ARCH"
/usr/bin/dkms install "vboxguest/${guest_version}" -k "${kernel_version}/x86_64"
/usr/bin/systemctl enable dkms.service
/usr/bin/systemctl enable vboxservice.service
/usr/bin/systemctl enable rpcbind.service
# Add groups for VirtualBox folder sharing
/usr/bin/groupadd vagrant
/usr/bin/usermod --append --groups vagrant,vboxsf vagrant