Skip to content

Instantly share code, notes, and snippets.

@mlowen
Created May 3, 2020 10:16
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 mlowen/ac93b3a49fc4038343b9e811befb28fc to your computer and use it in GitHub Desktop.
Save mlowen/ac93b3a49fc4038343b9e811befb28fc to your computer and use it in GitHub Desktop.
#! /bin/bash
set -e
if [[ ! -z $(which rr) ]]; then
echo rr is already installed, bailing now.
exit 1
fi
if [[ -z $(which java) ]]; then
echo Java is not installed please install before rr
exit 1
fi
VERSION="1.62"
if [[ ! -z "$1" ]]; then
VERSION=$1
fi
RR_NAME="rr-$VERSION-java8"
REMOTE_ARCHIVE="https://github.com/GuntherRademacher/rr/releases/download/v$VERSION/$RR_NAME.zip"
LOCAL_ARCHIVE="/tmp/$RR_NAME.zip"
# Just some test directories
INSTALL_DIR="/usr/local/etc/$RR_NAME"
LAUNCH_SCRIPT=/usr/local/bin/rr
curl -sSL $REMOTE_ARCHIVE -o $LOCAL_ARCHIVE
unzip -qq $LOCAL_ARCHIVE -d $INSTALL_DIR
rm -f $LOCAL_ARCHIVE
cat > $LAUNCH_SCRIPT <<- EOF
#! /bin/bash
java -jar $INSTALL_DIR/rr.war \$@
EOF
chmod +x $LAUNCH_SCRIPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment