File update.sh of Package luabind

#!/bin/sh
set -e
NAME="luabind"
BASE_VERSION="0.9.1"
GIT_URL="https://github.com/rpavlik/luabind.git"
# Remove old source tarball
osc rm --force "$NAME"*".tar.xz"
git clone "$GIT_URL" "$NAME"
cd "$NAME"
# Get date of last commit
DATE=$(git log -1 --format=%cI | grep -Po "^[0-9-]*" | sed "s/-//g")
export VERSION="$BASE_VERSION+$DATE"
echo "New date: $DATE New Version: $VERSION"
cd ..
# Create tarball
mv "$NAME" "$NAME-$VERSION"
tar --exclude-vcs -cJf "$NAME-$VERSION".tar.xz "$NAME-$VERSION"
rm -rf "$NAME-$VERSION/"
# Update version in spec file
sed -i "s/Version:.*/Version:        $VERSION/" "$NAME.spec"
# Add files to obs
osc add "$NAME-$VERSION.tar.xz"