Skip to content

Instantly share code, notes, and snippets.

@kadimi
Last active February 24, 2017 22:11
Show Gist options
  • Select an option

  • Save kadimi/995f97c10e24cb468377057ff89bd024 to your computer and use it in GitHub Desktop.

Select an option

Save kadimi/995f97c10e24cb468377057ff89bd024 to your computer and use it in GitHub Desktop.
packer-builder-vagrant Linux & Mac Installer
#!/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
@kadimi
Copy link
Author

kadimi commented Feb 19, 2017

packer-builder-vagrant Installer (Linux and Mac)

Description

Script to install or update packer-builder-vagrant.

Installation

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

@kadimi
Copy link
Author

kadimi commented Feb 19, 2017

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