Skip to content

Instantly share code, notes, and snippets.

@niratama
Last active March 28, 2016 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niratama/ec4b03216b02f52c0176 to your computer and use it in GitHub Desktop.
Save niratama/ec4b03216b02f52c0176 to your computer and use it in GitHub Desktop.
Vagrant+VirtualBox+vagrant-vbguest+CentOSでGuest Additionsがビルドできない一部のbox向け設定
class KernelDevelInstaller < VagrantVbguest::Installers::RedHat
def install(opts=nil, &block)
communicate.sudo(%q!OSREL=$(cat /etc/redhat-release | cut -d ' ' -f 4) && grep -q C${OSREL}- /etc/yum.repos.d/CentOS-Vault.repo || (cat /etc/yum.repos.d/CentOS-Vault.repo | grep -v ^# | sed '/-extras/,$d' | sed -e "s/[0-9]\.[0-9][0-9]*\(\.[0-9][0-9][0-9][0-9]\)/${OSREL}/" > /tmp/repo && cat /tmp/repo >> /etc/yum.repos.d/CentOS-Vault.repo && rm /tmp/repo && yum install -y "kernel-devel-$(uname -r)" --enablerepo="C${OSREL}-base,C${OSREL}-updates")!)
super
end
end
Vagrant.configure(2) do |config|
config.vbguest.installer = KernelDevelInstaller
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment