#!/usr/bin/bash -x

# adjust ssh for vagrant
sed -i "/^#\?PasswordAuthentication/d" /etc/ssh/sshd_config
sed -i "/^#\?PermitRootLogin/d" /etc/ssh/sshd_config
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config

# install VirtualBox Guest Additions
# @link: https://wiki.archlinux.org/index.php/VirtualBox
pacman -Sy --noconfirm virtualbox-guest-utils nfs-utils
echo -e 'vboxguest\nvboxsf\nvboxvideo' > /etc/modules-load.d/virtualbox.conf

# enable related virtualization and networking services
systemctl enable vboxservice.service
systemctl enable rpcbind.service

# Clean the pacman cache to minify image
yes | pacman -Scc
sync
