Last active
February 24, 2017 22:11
-
-
Save kadimi/995f97c10e24cb468377057ff89bd024 to your computer and use it in GitHub Desktop.
packer-builder-vagrant Linux & Mac Installer
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 | |
| # | |
| # `packer-builder-vagrant` Insaller (Linux and Mac) | |
| # = | |
| # | |
| # Description | |
| # == | |
| # | |
| # Script to install or update [packer-builder-vagrant](https://github.com/themalkolm/packer-builder-vagrant). | |
| # | |
| # Installation | |
| # == | |
| # | |
| # ```shell | |
| # bash <(wget -qO- http://bit.ly/gist-kadimi-995f97) | |
| # sudo mv ~/.packer.d/plugins/packer-builder-vagrant /usr/bin/packer-builder-vagrant | |
| # chmod +x /usr/bin/packer-builder-vagrant | |
| # ``` | |
| # | |
| # Identify OS | |
| case "$OSTYPE" in | |
| darwin*) pattern='darwin';; | |
| linux*) pattern='linux';; | |
| # msys*) pattern='windows';; | |
| *) echo 'Error: OS not recognized.' & exit 1;; | |
| esac | |
| # Prepare URL | |
| version=$(packer --version) | |
| url=$( | |
| curl -s https://api.github.com/repos/themalkolm/packer-builder-vagrant/releases \ | |
| | grep browser_download_url \ | |
| | grep $version \ | |
| | grep $pattern \ | |
| | head -n 1 \ | |
| | cut -d '"' -f 4 \ | |
| ) | |
| # Prepare file path | |
| case "$pattern" in | |
| *) dir="$HOME/.packer.d/plugins/";; | |
| esac | |
| mkdir -p "$dir" | |
| file="$dir"packer-builder-vagrant | |
| # Download | |
| echo -e "\e[1mDownloading $url...\e[0m" | |
| wget -q --show-progress "$url" -O "$file" | |
| echo -e "\e[1mDownload complete.\e[0m" | |
| echo -e "\e[1m\e[32mpacker-builder-vagrant was installed successfully.\e[0m" | |
| exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
packer-builder-vagrantInstaller (Linux and Mac)Description
Script to install or update packer-builder-vagrant.
Installation