Skip to content

Instantly share code, notes, and snippets.

@runcom
Last active Jun 1, 2017
Embed
What would you like to do?
Shell script to upgrade your vagrant to the latest version
#!/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
@runcom

This comment has been minimized.

Copy link
Owner Author

@runcom runcom commented Feb 11, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment