Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions install-guard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ main() {
mkdir -p ~/.guard/"$MAJOR_VER" ~/.guard/bin ||
err "unable to make directories ~/.guard/$MAJOR_VER, ~/.guard/bin"
get_os_type
download https://github.com/aws-cloudformation/cloudformation-guard/releases/download/"$VERSION"/cfn-guard-v"$MAJOR_VER"-"$ARCH_TYPE"-"$OS_TYPE"-latest.tar.gz >/tmp/guard.tar.gz ||
err "unable to download https://github.com/aws-cloudformation/cloudformation-guard/releases/download/$VERSION/cfn-guard-v$MAJOR_VER-$ARCH_TYPE-$OS_TYPE-latest.tar.gz"
if [ "$MAJOR_VER" -le 2 ] || [ "$VERSION" = "3.0.0" ]; then
FILENAME="cfn-guard-v$MAJOR_VER-$OS_TYPE-latest"
else
FILENAME="cfn-guard-v$MAJOR_VER-$ARCH_TYPE-$OS_TYPE-latest"
fi
download https://github.com/aws-cloudformation/cloudformation-guard/releases/download/"$VERSION/$FILENAME".tar.gz >/tmp/guard.tar.gz ||
err "unable to download https://github.com/aws-cloudformation/cloudformation-guard/releases/download/$VERSION/$FILENAME.tar.gz"
tar -C ~/.guard/"$MAJOR_VER" -xzf /tmp/guard.tar.gz ||
err "unable to untar /tmp/guard.tar.gz"
ln -sf ~/.guard/"$MAJOR_VER"/cfn-guard-v"$MAJOR_VER"-"$ARCH_TYPE"-"$OS_TYPE"-latest/cfn-guard ~/.guard/bin ||
ln -sf ~/.guard/"$MAJOR_VER/$FILENAME"/cfn-guard ~/.guard/bin ||
err "unable to symlink to ~/.guard/bin directory"
~/.guard/bin/cfn-guard help ||
err "cfn-guard was not installed properly"
Expand Down