Last active
June 1, 2017 10:11
-
-
Save runcom/39fc1ca01689aeb8f6d9 to your computer and use it in GitHub Desktop.
Shell script to upgrade your vagrant to the latest version
This file contains 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
#!/bin/sh | |
ONLINE_VERSION=$(curl -s https://www.vagrantup.com/downloads.html) | grep -i 'x86_64.deb' | sed 's/.*\/vagrant_\(.*\)_x86_64\.deb.*/\1/i' | |
SYSTEM_VERSION=$(vagrant --version) | sed 's/^vagrant \(.*\)$/\1/i' | |
VAGRANT_CHECK=$(command -v vagrant >/dev/null 2>&1) | |
#if [ "$VAGRANT_CHECK" = 1 ]; then | |
#novagrant | |
#else | |
#vagrant | |
#fi | |
if [ "$ONLINE_VERSION" != "$SYSTEM_VERSION" ]; then | |
echo "Downloading and installing Vagrant $ONLINE_VERSION (System version $SYSTEM_VERSION)" | |
PACKAGE=$(curl -s https://www.vagrantup.com/downloads.html) | grep -i 'x86_64.deb' | sed 's/.*href="\(.*\)".*/\1/i' | |
wget $PACKAGE /tmp/vagrant.deb | |
sudo dpkg -i /tmp/vagrant.deb | |
rm /tmp/vagrant.deb | |
echo "Vagrant successfully updated to $ONLINE_VERSION" | |
else | |
echo "No new Vagrant version!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wget https://gist.github.com/runcom/39fc1ca01689aeb8f6d9/raw/32a999a20c363d37760cdafeceefac00301da169/update-vagrant && chmod u+x update-vagrant
Also move the file to
/home/$USER/bin
or/usr/local/bin
if you like