From 906f0ee80eeff687ec1a0d728f50893bbc354107 Mon Sep 17 00:00:00 2001 From: Steve Clement Date: Wed, 20 Jan 2021 03:35:27 +0000 Subject: [PATCH] chg: [sh] moved depenency check to seperate file --- checkDeps.sh | 19 +++++++++++++++++++ deploy.sh | 19 +------------------ 2 files changed, 20 insertions(+), 18 deletions(-) create mode 100644 checkDeps.sh diff --git a/checkDeps.sh b/checkDeps.sh new file mode 100644 index 0000000..4c9447a --- /dev/null +++ b/checkDeps.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +GOT_PACKER=$(which packer > /dev/null 2>&1; echo $?) +if [[ "${GOT_PACKER}" == 0 ]]; then + echo "Packer detected, version: $(packer -v)" + PACKER_RUN=$(which packer) +else + echo "No packer binary detected, please make sure you installed it from: https://www.packer.io/downloads.html" + exit 1 +fi + +GOT_RHASH=$(which rhash > /dev/null 2>&1; echo $?) +if [[ "${GOT_RHASH}" == 0 ]]; then + echo "rhash detected, version: $(rhash --version)" + RHASH_RUN=$(which rhash) +else + echo "No rhash binary detected, please make sure you installed it." + exit 1 +fi diff --git a/deploy.sh b/deploy.sh index b352e19..8ea4680 100755 --- a/deploy.sh +++ b/deploy.sh @@ -14,24 +14,7 @@ source config.sh ### ---- NO TOUCHY BEYOND THIS POINT, PLEASE --- ### -# TODO: Move into seprate file -GOT_PACKER=$(which packer > /dev/null 2>&1; echo $?) -if [[ "${GOT_PACKER}" == 0 ]]; then - echo "Packer detected, version: $(packer -v)" - PACKER_RUN=$(which packer) -else - echo "No packer binary detected, please make sure you installed it from: https://www.packer.io/downloads.html" - exit 1 -fi - -GOT_RHASH=$(which rhash > /dev/null 2>&1; echo $?) -if [[ "${GOT_RHASH}" == 0 ]]; then - echo "rhash detected, version: $(rhash --version)" - RHASH_RUN=$(which rhash) -else - echo "No rhash binary detected, please make sure you installed it." - exit 1 -fi +source checkDeps.sh # Latest version of misp VER=$(curl -s https://api.github.com/repos/${REPO}/tags |jq -r '.[0] | .name')