64 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			64 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # Copyright (c) 2021 Battelle Energy Alliance, LLC.  All rights reserved.
 | |
| 
 | |
| unless Vagrant.has_plugin?("vagrant-reload")
 | |
|   raise 'vagrant-reload plugin is not installed!'
 | |
| end
 | |
| 
 | |
| # hack: https://github.com/hashicorp/vagrant/issues/8878#issuecomment-345112810
 | |
| class VagrantPlugins::ProviderVirtualBox::Action::Network
 | |
|   def dhcp_server_matches_config?(dhcp_server, config)
 | |
|     true
 | |
|   end
 | |
| end
 | |
| 
 | |
| Vagrant.configure("2") do |config|
 | |
| 
 | |
|   config.vm.box = "bento/debian-10"
 | |
| 
 | |
|   config.vm.network "private_network", type: "dhcp"
 | |
| 
 | |
|   config.vm.synced_folder '.', '/vagrant', disabled: true
 | |
|   config.vm.synced_folder "../..", "/malcolm-build"
 | |
| 
 | |
|   if Vagrant.has_plugin?("vagrant-vbguest")
 | |
|     config.vbguest.auto_update = false
 | |
|   end
 | |
| 
 | |
|   config.vm.provider "virtualbox" do |vb|
 | |
|     vb.memory = "8192"
 | |
|     vb.cpus = 4
 | |
|   end
 | |
| 
 | |
|   config.vm.provision "shell", inline: <<-STEP1
 | |
|     dpkg-reconfigure debconf -f noninteractive -p critical
 | |
|     export DEBIAN_FRONTEND=noninteractive
 | |
|     apt-mark hold grub-pc
 | |
|     apt-get -qqy update
 | |
|     apt-get -y dist-upgrade
 | |
|     sed -i "s/main/main contrib non-free/g" /etc/apt/sources.list
 | |
|     echo "deb http://httpredir.debian.org/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list
 | |
|     echo "deb-src http://httpredir.debian.org/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list
 | |
|     apt-get -qqy update
 | |
|     export KERNEL_VERSION=$(apt-cache search linux-image-5.10 | grep -Pv -- '(-(rt|cloud)-amd64|amd64-(dbg|unsigned))' | sort -r --sort=version | awk '{print $1}' | head -n 1 | sed 's/^linux-image-//' | sed 's/-amd64$//')
 | |
|     apt-get -t buster-backports -y install \
 | |
|       linux-image-$KERNEL_VERSION-amd64 linux-headers-$KERNEL_VERSION-amd64 linux-headers-$KERNEL_VERSION-common \
 | |
|       dkms build-essential linux-kbuild-5.10 linux-compiler-gcc-8-x86 \
 | |
|       firmware-linux firmware-linux-nonfree firmware-misc-nonfree firmware-amd-graphics
 | |
|     ls /dev/disk/by-id/ata-* | grep -v '\\-part' | head -n 1 | xargs -r -l grub-install
 | |
|   STEP1
 | |
|   config.vm.provision :reload
 | |
| 
 | |
|   config.vm.provision "shell", inline: <<-STEP2
 | |
|     export DEBIAN_FRONTEND=noninteractive
 | |
|     apt-get -qqy update
 | |
|     apt-get -t buster-backports -y install \
 | |
|       rsync git live-build debootstrap xorriso squashfs-tools genisoimage pandoc imagemagick \
 | |
|       apt-transport-https ca-certificates curl gnupg2 software-properties-common
 | |
|     curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
 | |
|     add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
 | |
|     apt-get -qqy update
 | |
|     apt-get -y install docker-ce docker-ce-cli containerd.io
 | |
|     usermod -a -G docker vagrant
 | |
|   STEP2
 | |
| end
 |