Skip to content

Instantly share code, notes, and snippets.

@jan-swiecki
Last active May 1, 2021 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jan-swiecki/c0b7107f438c700cb00f2c079056c3b0 to your computer and use it in GitHub Desktop.
Save jan-swiecki/c0b7107f438c700cb00f2c079056c3b0 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eou pipefail
VERSION="$2"
cd /tmp
set -x
# trap "rm $5" EXIT
rm SHA256SUM || true
checksums="$4"
bin="$3"
set +o pipefail
[ -f "$checksums" ] || wget "$1/$VERSION/$checksums"
[ -f "$bin" ] || wget "$1/$VERSION/$bin"
set -o pipefail
if [[ "$checksums" =~ \.asc$ ]]; then
gpg --verify "$checksums" "$bin"
else
cat "$checksums" | grep $bin >> SHA256SUM
sha256sum -c SHA256SUM
fi
if [ "$?" -ne 0 ]; then
echo "error: wrong sha25sum / gpg signature" >&2
exit 1
fi
if [[ "$bin" =~ \.zip$ ]]; then
unzip "$bin"
eval "$6"
else
chmod +x "$bin"
mv "$bin" "$HOME/.local/bin/$6"
fi
echo "success"
#!/bin/bash
set -eo pipefail
# https://jeremylong.github.io/DependencyCheck/dependency-check-ant/index.html
gpg --keyserver hkp://keys.gnupg.net --recv-keys F9514E84AE3708288374BBBE097586CFEA37F9A6
version="6.1.6"
./_install_github_release \
"https://github.com/jeremylong/DependencyCheck/releases/download" \
"v${version}" \
"dependency-check-${version}-release.zip" \
"dependency-check-${version}-release.zip.asc" \
"dependency-check*" \
"
{ rm -rf $HOME/opt/dependency-check >/dev/null 2>&1 || true; } \
&& mkdir -p $HOME/opt \
&& mkdir -p $HOME/.local/bin \
&& mv dependency-check $HOME/opt/dependency-check \
&& ln -sf $HOME/opt/dependency-check/bin/dependency-check.sh $HOME/.local/bin/dependency-check
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment