mirror of https://github.com/MISP/misp-packer
chg: [bling] Added ponysay check and added shorter commit hash
parent
9a737b08ba
commit
2402b50e88
23
deploy.sh
23
deploy.sh
|
@ -7,6 +7,7 @@ TIME_START=$(date +%s)
|
||||||
VER=$(curl -s https://api.github.com/repos/MISP/MISP/tags |jq -r '.[0] | .name')
|
VER=$(curl -s https://api.github.com/repos/MISP/MISP/tags |jq -r '.[0] | .name')
|
||||||
# Latest commit hash of misp
|
# Latest commit hash of misp
|
||||||
LATEST_COMMIT=$(curl -s https://api.github.com/repos/MISP/MISP/commits |jq -r '.[0] | .sha')
|
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
|
if [ "${VER}" == "" ] || [ "${LATEST_COMMIT}" == "" ] ; then
|
||||||
echo "Somehow, could not 'curl' either a version or a commit tag, exiting -1..."
|
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()
|
function removeAll()
|
||||||
{
|
{
|
||||||
# Remove files for next run
|
# Remove files for next run
|
||||||
|
@ -132,7 +150,8 @@ if [ "${LATEST_COMMIT}" != "$(cat /tmp/misp-latest.sha)" ]; then
|
||||||
TIME_END=$(date +%s)
|
TIME_END=$(date +%s)
|
||||||
TIME_DELTA=$(expr ${TIME_END} - ${TIME_START})
|
TIME_DELTA=$(expr ${TIME_END} - ${TIME_START})
|
||||||
|
|
||||||
echo "The generation took ${TIME_DELTA} seconds"
|
say "The generation took ${TIME_DELTA} seconds"
|
||||||
else
|
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
|
fi
|
||||||
|
|
Loading…
Reference in New Issue