From e95eb5e9fc50bb162cdd48187f731bd0f6ca8015 Mon Sep 17 00:00:00 2001 From: Benjamin Sago Date: Sat, 10 Oct 2020 00:21:20 +0100 Subject: [PATCH] Vagrant changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Get rid of the 'fresh' VM. It just got in the way, taking up more memory when 'vagrant up' was used, and only solved one problem that was happening three years ago when I was at RustFest and in a programm-y mood. • Use a more up-to-date Ubuntu image and give the machine more cores. • Start moving some of the developer tools out of this repo. As I get more and more Rust projects, I don't want the scripts to package them to be repeated in each repository. --- Vagrantfile | 52 ++-------------------- devtools/README.md | 6 +-- devtools/dev-download-and-check-release.sh | 51 --------------------- devtools/dev-generate-checksums.sh | 15 ------- devtools/dev-help-testvm.sh | 12 ----- 5 files changed, 7 insertions(+), 129 deletions(-) delete mode 100644 devtools/dev-download-and-check-release.sh delete mode 100644 devtools/dev-generate-checksums.sh delete mode 100644 devtools/dev-help-testvm.sh diff --git a/Vagrantfile b/Vagrantfile index a8b4c59..4d27762 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,19 +4,18 @@ Vagrant.configure(2) do |config| # We use Ubuntu instead of Debian because the image comes with two-way # shared folder support by default. - UBUNTU = 'bento/ubuntu-16.04' + UBUNTU = 'hashicorp/bionic64' - # The main VM is the one used for development and testing. - config.vm.define(:exa, primary: true) do |config| + config.vm.define(:exa) do |config| config.vm.provider :virtualbox do |v| v.name = 'exa' v.memory = 2048 - v.cpus = 2 + v.cpus = `nproc`.chomp.to_i end config.vm.provider :vmware_desktop do |v| v.vmx['memsize'] = '2048' - v.vmx['numvcpus'] = '2' + v.vmx['numvcpus'] = `nproc`.chomp end config.vm.box = UBUNTU @@ -562,47 +561,4 @@ Vagrant.configure(2) do |config| EOF end end - - - # Remember that problem that exa had where the binary wasn’t actually - # self-contained? Or the problem where the Linux binary was actually the - # macOS binary in disguise? - # - # This is a “fresh” VM that intentionally downloads no dependencies and - # installs nothing so that we can check that exa still runs! - config.vm.define(:fresh) do |config| - config.vm.box = UBUNTU - config.vm.hostname = 'fresh' - - config.vm.provider :virtualbox do |v| - v.name = 'exa-fresh' - v.memory = 384 - v.cpus = 1 - end - - # Well, we do need *one* dependency... - config.vm.provision :shell, privileged: true, inline: <<-EOF - set -xe - apt-get install -qq -o=Dpkg::Use-Pty=0 -y unzip - EOF - - # This thing also has its own welcoming text. - config.vm.provision :shell, privileged: true, inline: <<-EOF - rm -f /etc/update-motd.d/* - - # Capture the help text so it gets displayed first - bash /vagrant/devtools/dev-help-testvm.sh > /etc/motd - - # Disable last login date in sshd - sed -i '/PrintLastLog yes/c\PrintLastLog no' /etc/ssh/sshd_config - systemctl restart sshd - EOF - - # Make the checker script a command. - config.vm.provision :shell, privileged: true, inline: <<-EOF - set -xe - echo -e "#!/bin/sh\nbash /vagrant/devtools/dev-download-and-check-release.sh \"\\$*\"" > /usr/bin/check-release - chmod +x /usr/bin/check-release - EOF - end end diff --git a/devtools/README.md b/devtools/README.md index 8136bdd..29f1e65 100644 --- a/devtools/README.md +++ b/devtools/README.md @@ -1,5 +1,5 @@ -## exa development tools +## exa › development tools -These scripts deal with things like packaging release-worthy versions of exa and making sure the published versions actually work. +These scripts deal with things like packaging release-worthy versions of exa. -They are **not general-purpose scripts** that you’re able to run from your main computer! They’re intended to be run from the Vagrant machines — they have commands such as ‘package-exa’ or ‘check-release’ that execute them instead. +They are **not general-purpose scripts** that you’re able to run from your main computer! They’re intended to be run from the Vagrant machine. diff --git a/devtools/dev-download-and-check-release.sh b/devtools/dev-download-and-check-release.sh deleted file mode 100644 index d2b89a9..0000000 --- a/devtools/dev-download-and-check-release.sh +++ /dev/null @@ -1,51 +0,0 @@ -# This script downloads the published versions of exa from GitHub and my site, -# checks that the checksums match, and makes sure the files at least unzip and -# execute okay. -# -# The argument should be of the form “0.8.0”, no ‘v’. That version was the -# first one to offer checksums, so it’s the minimum version that can be tested. - -set +x -trap 'exit' ERR - -exa_version=$1 -if [[ -z "$exa_version" ]]; then - echo "Please specify a version, such as '$0 0.8.0'" - exit 1 -fi - - -# Delete anything that already exists -rm -rfv "/tmp/${exa_version}-downloads" - - -# Create a temporary directory and download exa into it -mkdir "/tmp/${exa_version}-downloads" -cd "/tmp/${exa_version}-downloads" - -echo -e "\n\033[4mDownloading stuff...\033[0m" -wget --quiet --show-progress "https://github.com/ogham/exa/releases/download/v${exa_version}/exa-macos-x86_64-${exa_version}.zip" -wget --quiet --show-progress "https://github.com/ogham/exa/releases/download/v${exa_version}/exa-linux-x86_64-${exa_version}.zip" - -wget --quiet --show-progress "https://github.com/ogham/exa/releases/download/v${exa_version}/MD5SUMS" -wget --quiet --show-progress "https://github.com/ogham/exa/releases/download/v${exa_version}/SHA1SUMS" - - -# Unzip the zips and check the sums -echo -e "\n\033[4mExtracting that stuff...\033[0m" -unzip "exa-macos-x86_64-${exa_version}.zip" -unzip "exa-linux-x86_64-${exa_version}.zip" - -echo -e "\n\033[4mValidating MD5 checksums...\033[0m" -md5sum -c MD5SUMS - -echo -e "\n\033[4mValidating SHA1 checksums...\033[0m" -sha1sum -c SHA1SUMS - - -# Finally, give the Linux version a go -echo -e "\n\033[4mChecking it actually runs...\033[0m" -./"exa-linux-x86_64" --version -./"exa-linux-x86_64" --long - -echo -e "\n\033[1;32mAll's lookin' good!\033[0m" diff --git a/devtools/dev-generate-checksums.sh b/devtools/dev-generate-checksums.sh deleted file mode 100644 index 0075c3f..0000000 --- a/devtools/dev-generate-checksums.sh +++ /dev/null @@ -1,15 +0,0 @@ -# This script generates the MD5SUMS and SHA1SUMS files. -# You’ll need to have run ‘dev-download-and-check-release.sh’ and -# ‘local-package-for-macos.sh’ scripts to generate the binaries first. - -set +x -trap 'exit' ERR - -cd /vagrant -rm -f MD5SUMS SHA1SUMS - -echo -e "\n\033[4mValidating MD5 checksums...\033[0m" -md5sum exa-linux-x86_64 exa-macos-x86_64 | tee MD5SUMS - -echo -e "\n\033[4mValidating SHA1 checksums...\033[0m" -sha1sum exa-linux-x86_64 exa-macos-x86_64 | tee SHA1SUMS diff --git a/devtools/dev-help-testvm.sh b/devtools/dev-help-testvm.sh deleted file mode 100644 index 0961792..0000000 --- a/devtools/dev-help-testvm.sh +++ /dev/null @@ -1,12 +0,0 @@ -# This file is like the other one, except for the testing VM. -# It also gets dumped into /etc/motd. - - -echo -e " -\033[1;33mThe exa testing environment!\033[0m -This machine is dependency-free, and can be used to test that -released versions of exa still work on vanilla Linux installs. - -\033[4mCommands\033[0m -\033[32;1mcheck-release\033[0m to download and verify released binaries -"