Created
March 6, 2020 16:15
-
-
Save djfdyuruiry/7ce70342fbd18e5d6313bd90a72ea65f to your computer and use it in GitHub Desktop.
Bash script that automatically downloads the latest Vagrant Ubuntu package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
set -e | |
vagrantBaseUrl="https://releases.hashicorp.com" | |
latestRelease=$(\ | |
wget -q -O - "${vagrantBaseUrl}/vagrant/" \ | |
| grep 'a href="' \ | |
| grep -v '<a href="../">../</a>' \ | |
| head -n 1 \ | |
| grep -oP '(?<=<a href="/vagrant/)(.+)(?=/")' \ | |
) | |
debianPackage=$( | |
wget -q -O - "${vagrantBaseUrl}/vagrant/${latestRelease}/" \ | |
| grep -oP '(?<=href=").+_x86_64.deb(?=")' | |
) | |
downloadUrl="${vagrantBaseUrl}${debianPackage}" | |
wget -q --trust-server-names "${downloadUrl}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment