Skip to content

Instantly share code, notes, and snippets.

@brcolow
Created December 24, 2016 00: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 brcolow/27a36157587701f084c56e346cadc217 to your computer and use it in GitHub Desktop.
Save brcolow/27a36157587701f084c56e346cadc217 to your computer and use it in GitHub Desktop.
Sync Script
#!/usr/bin/env bash
# Usage info
show_help() {
cat << EOF
Usage: ${0##*/} [-hf]
Syncs the TestFX Monocle repository with upstream.
-h display this help and exit
EOF
}
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
reset=$(tput sgr0)
exists()
{
command -v "$1" >/dev/null 2>&1
}
installed_pup=false
if ! exists pup; then
echo "Installing pup (command-line HTML parser)"
wget --quiet https://github.com/ericchiang/pup/releases/download/v0.4.0/pup_v0.4.0_linux_amd64.zip
if [[ $(sha256sum pup_v0.4.0_linux_amd64.zip | head -c 64) != "ec3d29e9fb375b87ac492c8b546ad6be84b0c0b49dab7ff4c6b582eac71ba01c" ]]; then
echo "${red}✘ Error (integrity): pup release download checksum failed${reset}" >&2
exit
fi
unzip pup_v0.4.0_linux_amd64.zip
installed_pup=true
fi
if [ $installed_pup = true ]; then
pup='./pup'
else
pup='pup'
fi
raw_tags=$(curl -s http://hg.openjdk.java.net/openjfx/8u-dev/rt/tags | ${pup} '.tagEntry text{}' | sed '/3a7f004c4995/q' | xargs echo -n)
echo "Raw tags: ${raw_tags}"
declare -A tags;
IFS=' '
while read -r name tag; do
tags[$name]=$tag
done <<<$raw_tags
for key in "${!tags[@]}"
do
printf "%s: %s\n" "$key" "${tags[$key]}"
done
# The associative array "tags" is broken...it contains one key "tip" with a value of the rest
# of the string instead of it being like:
# tip: 25232792bc69
# 8u152-b00: 4412a03e297b
# 8u132-b00: 5151b4f818af
# etc...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment