From: Holger Levsen Date: Tue, 23 Jul 2013 13:05:24 +0000 (+0200) Subject: add debian_wrap_maven_results.sh as taken from Szymon from vdc-bundles.git, branch... X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=0d2b1ec88507456c4d4ae88e66b14d1713002693;p=profitbricks%2Fjenkins-build-scripts.git add debian_wrap_maven_results.sh as taken from Szymon from vdc-bundles.git, branch feature/debian --- diff --git a/debian_wrap_maven_results.sh b/debian_wrap_maven_results.sh new file mode 100755 index 0000000..4d20968 --- /dev/null +++ b/debian_wrap_maven_results.sh @@ -0,0 +1,82 @@ +#!/bin/bash +DISTRIBUTION=$1 +VERSION=$2 +COMMENT=$3 +SCRIPTNAME=${0##*/} + +function cleanup { + echo cleaning up ... + + # revert changelog changes + git checkout -- debian/changelog + + # remove files created by debian build + git clean -fd debian + + echo cleaup done +} + +function failIfFailed +{ + echo executing: \'$@\' ... + $@ + RET_CODE=$? + if [[ "${RET_CODE}" != "0" ]] + then + echo command \'$@\' failed + cleanup + exit 4 + + fi + echo done +} + +function usage +{ + echo 'Usage:' ${SCRIPTNAME} ' ' + exit $1 +} + +function validateInput +{ + if [[ -z "${DISTRIBUTION}" ]] + then + echo "Need to specify distribution" + usage 1 + fi + + if [[ -z "${VERSION}" ]] + then + echo "Need to specify version" + usage 2 + fi + + if [[ -z "${COMMENT}" ]] + then + echo "Need to specify Comment" + usage 3 + fi + +} + +function goUp +{ + cd .. +} + +goUp + +validateInput + +# change version in changelog +failIfFailed dch -D${DISTRIBUTION} -v ${VERSION} ${COMMENT} + + +#build debian package +failIfFailed dpkg-buildpackage -us -uc + +# upload to reprepro +# TODO: implement + +cleanup +