#!/bin/sh

set -e
set -u

OLDVERSION=$(/bin/grep "__version__ = " setup.py | \
             sed -E "s/^.*__version__ = '(.*)'/\1/g")
echo "Current version is $OLDVERSION. Please enter the new version"
read NEWVERSION

sed -i -E "s/__version__ = '$OLDVERSION'/__version__ = '$NEWVERSION'/g" setup.py

sed -i -E "s/__version__ = '$OLDVERSION'/__version__ = '$NEWVERSION'/g" tailsgreeter/__init__.py

dch --newversion $NEWVERSION

echo "Please verify the changes, and commit e.g.:"
echo "    git commit debian/changelog setup.py tailsgreeter/__init__.py -m 'Update version to $NEWVERSION'"
