Skip to content

Commit

Permalink
dev: add utility script to assist with development (#6)
Browse files Browse the repository at this point in the history
Co-authored-by: Justin Burr <juburr@users.noreply.github.com>
  • Loading branch information
juburr and juburr authored Sep 12, 2024
1 parent 9bac60f commit 61540d6
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/scripts/install_hash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# Convenience script, not used by directly by the production orb, but
# for development purposes when adding SHA-512 checksums to the lookup
# table in install.sh.

set -e
set +o history

# Fetch CLI arguments
# Can also be set as environment variables.
while getopts :v: flag
do
case "${flag}" in
v) VERSION=${OPTARG};;
*) echo "Invalid option: -${OPTARG}" >&2; exit 1;;
esac
done

# Validate input arguments
if [[ -z "${VERSION}" ]]; then
echo "Must specify a version number."
echo "Usage: $0 -v 1.0.0"
echo "Alternatively: VERSION=1.0.0 $0"
exit 1
fi

# Download the specified version and get the SHA-512 checksum of
# the kubescape binary inside. Suppress output for readability; this is
# dev script, so simply re-enable output if you need to debug anything.
cd /tmp
wget "https://github.com/kubescape/kubescape/releases/download/v${VERSION}/kubescape-ubuntu-latest" -O kubescape -q
CHECKSUM=$(sha512sum /tmp/kubescape | awk '{ print $1 }')
echo "[\"${VERSION}\"]=\"${CHECKSUM}\""
rm /tmp/kubescape

0 comments on commit 61540d6

Please sign in to comment.