#!/bin/bash
DISTRIBUTION=$1
-VERSION=$2
-COMMENT=$3
+VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version | grep -v "^\[") # TODO: check for valid version?
SCRIPTNAME=${0##*/}
+VALID_DISTROS=("unstable" "wheezy" "squeeze")
+
+function containsElement () {
+ local e
+ for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
+ return 1
+}
function cleanup {
echo cleaning up ...
function usage
{
- echo 'Usage:' ${SCRIPTNAME} '<DISTRIBUTION> <VERSION> <COMMENT>'
+ echo 'Usage:' ${SCRIPTNAME} '<DISTRIBUTION>'
exit $1
}
function validateInput
{
- if [[ -z "${DISTRIBUTION}" ]]
+
+ if ! containsElement $DISTRIBUTION "${VALID_DISTROS[@]}" ;
then
- echo "Need to specify distribution"
+ echo "\$DISTRIBUTION is set to $DISTRIBUTION but thats not a valid distribution, which are: $VALID_DISTROS"
usage 1
fi
usage 2
fi
- if [[ -z "${COMMENT}" ]]
- then
- echo "Need to specify Comment"
- usage 3
- fi
-
}
function goUp
validateInput
# change version in changelog
-failIfFailed dch -D${DISTRIBUTION} -v ${VERSION} ${COMMENT}
+# TODO: fix comment
+failIfFailed dch -D${DISTRIBUTION} -v ${VERSION} "dummy comment"
#build debian package