cloud-init/tools/read-version
Joshua Harlow a80727a512 Reworking these to look attempt to find the right parent directory, as well
as adjustments due to sysvinit rename.
2012-07-06 17:29:09 -07:00

28 lines
479 B
Bash
Executable File

#!/bin/sh
set -e
if [ -e "setup.py" ]
then
ROOT_DIR="$PWD"
elif [ -e "../setup.py" ]
then
ROOT_DIR="$PWD/../"
else
echo "Unable to locate 'setup.py' file that should" \
"exist in the cloud-init root directory."
exit 1
fi
CHNG_LOG="$ROOT_DIR/ChangeLog"
if [ ! -e "$CHNG_LOG" ]
then
echo "Unable to find 'ChangeLog' file located at $CHNG_LOG"
exit 1
fi
VERSION=$(grep -P "\d+.\d+.\d+:" $CHNG_LOG | cut -f1 -d ":" | head -n 1)
echo $VERSION