Skip to content

Instantly share code, notes, and snippets.

@RichMorin

RichMorin/Vagrantfile Secret

Created Dec 11, 2019
Embed
What would you like to do?
Vagrantfile which tries to load OSS
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This is `Vagrantfile.make`. It specifies the configuration of the VM
# that should be used in creating the Perkify image.
Vagrant.configure("2") do |config|
vm = config.vm
vm.box = "bento/ubuntu-19.04"
vm.box_version = "201906.18.0"
vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
config.ssh.forward_x11 = true # Set up port forwarding for X11.
vm.provision "shell", inline: <<-SHELL
# General Perkify setup code
set -e # Stop on any error
set -x # Trace commands
export DEBIAN_FRONTEND=noninteractive
hostname perkify-make
apt-get update
# OSS audio setup code, adapted (with thanks!) from
# https://github.com/GeoffreyPlitt/vagrant-audio
usermod -a -G audio vagrant
apt-get install -y \
oss4-base oss4-dkms oss4-source oss4-gtk debconf-utils
uname=$(uname -r)
ln -s /usr/src/linux-headers-$uname/ \
/lib/modules/$uname/source || echo ALREADY SYMLINKED
module-assistant prepare -i
module-assistant auto-install -i oss4 # This can take two minutes.
dss='linux-sound-base linux-sound-base/sound_system select OSS'
debconf-set-selections <<< $dss
echo READY.
# Have to reboot for drivers to kick in (only the first time, of course).
if [ ! -f ~/runonce ]; then
reboot
touch ~/runonce
fi
SHELL
# Customize settings to enable audio drivers on VM.
vm.provider :virtualbox do |vb|
if RUBY_PLATFORM =~ /darwin/
vb.customize ['modifyvm', :id,
'--audio', 'coreaudio',
'--audiocontroller', 'hda' # choices: hda sb16 ac97
]
elsif RUBY_PLATFORM =~ /bccwin|cygwin|emx|mingw|mswin/
vb.customize ['modifyvm', :id,
'--audio', 'dsound',
'--audiocontroller', 'ac97']
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.