GithubHelp home page GithubHelp logo

jmorgan415 / packer-installer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from robertpeteuil/packer-installer

0.0 1.0 0.0 16 KB

Packer Installer - Automatic Download, Extract and Install of Latest or Specific Version

License: Apache License 2.0

Shell 100.00%

packer-installer's Introduction

Packer Installer - Automated Packer Installation

Automatically Download, Extract and Install Latest or Specific Version

release bash license


The packer-install script automates the process of downloading and installing Packer. It provides an ideal method for installing on new hosts, installing updates and downgrading if necessary.

This script detects the latest version, OS and CPU-Architecture and allows installation to local or system locations. Optional parameters allow installing a specific version and installing to /usr/local/bin without prompting.

Options:

  • -i VERSION: Install specific version
  • -a: Automatically use sudo to install to /usr/local/bin
    • allows for unattended installation via scripts or CD tools
    • can be set as default behavior by uncommenting line 14 (sudoInstall=true)
    • sudo password may be required unless NOPASSWD is enabled
  • -c: leave binary in working directory (for CI/DevOps use)
  • -h: help
  • -v: display version

This installer is similar to my Terraform Installer

Use

Local download

Download the installer with curl, make executable and run:

curl -LO https://raw.github.com/robertpeteuil/packer-installer/master/packer-install.sh

chmod +x packer-install.sh

./packer-install.sh

Running via macOS brew

This installer can be ran as a brew formula. Unlike the official Brew Packer formula, this does not compile from source so it doesn't have dependancies on go and gox.

brew install robpco/tap/packer

System Requirements

  • System with Bash Shell (Linux, macOS, Windows Subsystem for Linux)
  • unzip - packer downloads are in zip format
  • curl or wget - script will use either one to retrieve metadata and download

Optional

  • jq - if installed, latest version parsed from hashicorp downloads
    • Useful if latest github release differs from version on hashicorp downloads
    • Avoids github api limit of 60 requests per hour (unauthenticated)

Script Process Details

  • Determines Version to Download and Install
    • Uses Version specified by -i VERSION parameter (if specified)
    • Otherwise determines Latest Version
      • If jq installed parse version from hashicorp downloads
      • Otherwise use GitHub API to retrieve latest tag
  • Calculates Download URL based on Version, OS and CPU-Architecture
  • Verifies URL Validity before Downloading in Case:
    • VERSION incorrectly specified with -i
    • Download URL Format Changed on packer Website
  • Determines Install Destination
    • Performed before Download/Install Process in case user selects abort
  • Installation Process
    • Download, Extract, Install, Cleanup and Display Results

CPU Architecture Detection

CPU architecture is detected for each OS accordingly:

  • Linux / Windows (WSL since this is a Bash script)
    • detected with lscpu or by inspecting /proc/cpuinfo
  • macOS - uses Default Arch amd64 as it's the only version available on macOS
  • Default Value - amd64

License

Apache 2.0 License - Copyright (c) 2018 Robert Peteuil

packer-installer's People

Contributors

dnrajpaxata avatar robertpeteuil avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.