#!/usr/bin/env bash

ORIGIN="$(dirname "$0")"

overwritten=false
if [[ -e "${ORIGIN}/../libversions" ]]
then
    mv "${ORIGIN}/../libversions" "${ORIGIN}/../libversions~"
    overwritten=true
fi

bash "${ORIGIN}/latest_version.sh" > "${ORIGIN}/../libversions"

if $overwritten
then
    diff -u "${ORIGIN}/../libversions~" "${ORIGIN}/../libversions"
fi
