]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
add debian_wrap_maven_results.sh as taken from Szymon from vdc-bundles.git, branch...
authorHolger Levsen <holger@layer-acht.org>
Tue, 23 Jul 2013 13:05:24 +0000 (15:05 +0200)
committerHolger Levsen <holger@layer-acht.org>
Tue, 23 Jul 2013 13:05:24 +0000 (15:05 +0200)
debian_wrap_maven_results.sh [new file with mode: 0755]

diff --git a/debian_wrap_maven_results.sh b/debian_wrap_maven_results.sh
new file mode 100755 (executable)
index 0000000..4d20968
--- /dev/null
@@ -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} '<DISTRIBUTION> <VERSION> <COMMENT>'
+    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
+