#!/usr/bin/env bash
# This is just a script to update the Version in `polycat.spec`

set -ex
DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)

cd $DIR
git clone https://github.com/2IMT/polycat.git
cd polycat/
VERSION=$(printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)")
cd ..
rm -rf polycat/

sed -i "s/Version:.*/Version:        $VERSION/g" polycat.spec