2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> packer-install.sh"
12 # The script checks for the packer binaries and installs the binary
13 # if its not available
15 # $PACKER_VERSION : Define a packer version passed as job paramter
17 PACKER_VERSION="${PACKER_VERSION:-1.0.2}"
19 # Ensure we fail the job if any steps fail.
22 if hash packer.io 2>/dev/null; then
23 echo "packer.io command is available."
25 echo "packer.io command not is available. Installing packer ..."
26 # Installs Hashicorp's Packer binary, required for verify & merge packer jobs
28 wget -nv "https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip"
29 mkdir -p "${WORKSPACE}/bin"
30 unzip "packer_${PACKER_VERSION}_linux_amd64.zip" -d ${WORKSPACE}/bin/
31 # rename packer to avoid conflict with binary in cracklib
32 mv ${WORKSPACE}/bin/packer "${WORKSPACE}/bin/packer.io"