bootstrap.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env bash
  2. #
  3. # Prepares a virtual machine for running TFB
  4. # A shell provisioner is called multiple times
  5. if [ ! -e "~/.firstboot" ]; then
  6. # Workaround mitchellh/vagrant#289
  7. echo "grub-pc grub-pc/install_devices multiselect /dev/sda" | sudo debconf-set-selections
  8. # Install prerequisite tools
  9. echo "Installing docker"
  10. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  11. sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  12. sudo apt-get update -yqq
  13. sudo apt-get install -yqq docker-ce
  14. sudo usermod -aG docker vagrant
  15. # Setting up passwordless sudo
  16. echo "vagrant ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
  17. sudo chown vagrant:vagrant ~/FrameworkBenchmarks
  18. cd ~/FrameworkBenchmarks
  19. # Setup a nice welcome message for our guest
  20. echo "Setting up welcome message"
  21. sudo rm -f /etc/update-motd.d/51-cloudguest
  22. sudo rm -f /etc/update-motd.d/98-cloudguest
  23. sudo cat <<EOF > motd
  24. Welcome to the FrameworkBenchmarks project!
  25. You can get lots of help:
  26. $ tfb --help
  27. You can run a test like:
  28. $ tfb --mode verify --test gemini
  29. This Vagrant environment is already setup and ready to go.
  30. EOF
  31. cat <<EOF > /home/vagrant/.bash_aliases
  32. alias tfb="/home/vagrant/FrameworkBenchmarks/tfb"
  33. EOF
  34. sudo mv motd /etc/
  35. sudo chmod 777 /var/run/docker.sock
  36. fi