Skip to content

Instantly share code, notes, and snippets.

@tcooper
Created November 8, 2017 01:35
Show Gist options
  • Save tcooper/c656d4ffa2cc3053aba1781c41405f87 to your computer and use it in GitHub Desktop.
Save tcooper/c656d4ffa2cc3053aba1781c41405f87 to your computer and use it in GitHub Desktop.
Pull Rocks rolls from beta7.rocksclusters.org
#!/bin/bash
AWK=$(which awk)
CURL=$(which curl)
ECHO=$(which echo)
GREP=$(which grep)
SORT=$(which sort)
BASE="http://beta7.rocksclusters.org/isos"
ROLLS=$(${CURL} -s ${BASE}/ | ${AWK} -F\" '/iso\"/ {print $8}' | ${SORT} -u)
DEFAULT_OPTS="-s -LO"
MD5_SUMS="md5sums"
${CURL} ${DEFAULT_OPTS} ${BASE}/${MD5_SUMS}
${ECHO} "Downloading..."
for ROLL in ${ROLLS}; do
MSG=" ${ROLL}"
if [[ -f ${ROLL} ]]; then
OPTS="${DEFAULT_OPTS} -z ${ROLL} "
MSG="${MSG} if newer..."
else
OPTS="${DEFAULT_OPTS}"
MSG="${MSG}..."
fi
${ECHO} ${MSG}
${CURL} ${OPTS} ${BASE}/${ROLL}
ROLL_MD5=$(md5sum ${ROLL})
${GREP} -q ${ROLL_MD5} ./${MD5_SUMS}
if [[ 0 -eq $? ]]; then
${ECHO} " MD5SUM verification success for ${ROLL}"
else
${ECHO} " MD5SUM verification failure for ${ROLL}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment