Skip to content

Instantly share code, notes, and snippets.

@mkaczanowski
Created February 4, 2020 14:45
Show Gist options
  • Save mkaczanowski/be00b05adf2adcdaa9e89facf495285c to your computer and use it in GitHub Desktop.
Save mkaczanowski/be00b05adf2adcdaa9e89facf495285c to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/eoan64"
config.disksize.size = '15GB'
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install -y git qemu-user-static unzip snap
sudo snap install go --classic
rm -rf packer-builder-arm folder-to-upload *>/dev/null
git clone https://github.com/mkaczanowski/packer-builder-arm
cd packer-builder-arm
go mod download
go build
wget https://releases.hashicorp.com/packer/1.5.1/packer_1.5.1_linux_amd64.zip
unzip -d . packer_1.5.1_linux_amd64.zip
mkdir generated-images
mkdir ../folder-to-upload -p
for i in `seq 5`; do echo "test $i" > "../folder-to-upload/test_$i"; done
wget "https://gist.githubusercontent.com/mkaczanowski/1b6d827f99d0613b008340f9add63b19/raw/f1959156e39c92909183f5be847886c8d26c7d21/config" -O config.json
sudo ./packer build config.json
sudo losetup -D
sudo losetup -P /dev/loop8 generated-images/generated-raspbian.img
sudo mount /dev/loop8p2 /mnt/
sudo cat /mnt/home/pi/target-folder/test_*
SHELL
en
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment