chg: [bling] Added ponysay check and added shorter commit hash

pull/16/head
Steve Clement 2019-04-11 08:42:00 +02:00
parent 9a737b08ba
commit 2402b50e88
1 changed files with 21 additions and 2 deletions

View File

@ -7,6 +7,7 @@ TIME_START=$(date +%s)
VER=$(curl -s https://api.github.com/repos/MISP/MISP/tags |jq -r '.[0] | .name')
# Latest commit hash of misp
LATEST_COMMIT=$(curl -s https://api.github.com/repos/MISP/MISP/commits |jq -r '.[0] | .sha')
LATEST_COMMIT_SHORT=$(echo $LATEST_COMMIT|cut -c1-7)
if [ "${VER}" == "" ] || [ "${LATEST_COMMIT}" == "" ] ; then
echo "Somehow, could not 'curl' either a version or a commit tag, exiting -1..."
@ -57,6 +58,23 @@ fi
}
# Check if ponysay is installed. (https://github.com/erkin/ponysay)
say () {
if [[ $(command -v ponysay) ]]; then
ponysay -c $1
else
echo $1
fi
}
think () {
if [[ $(command -v ponythink) ]]; then
ponythink -c $1
else
echo $1
fi
}
function removeAll()
{
# Remove files for next run
@ -132,7 +150,8 @@ if [ "${LATEST_COMMIT}" != "$(cat /tmp/misp-latest.sha)" ]; then
TIME_END=$(date +%s)
TIME_DELTA=$(expr ${TIME_END} - ${TIME_START})
echo "The generation took ${TIME_DELTA} seconds"
say "The generation took ${TIME_DELTA} seconds"
else
echo "Current ${PACKER_VM} version ${VER}@${LATEST_COMMIT} is up to date."
clear
think "Current ${PACKER_VM} version ${VER}@${LATEST_COMMIT_SHORT} is up to date."
fi