2 # Filename: scripts/release_helper.sh
3 # Purpose: helper script to build grml-live Debian packages
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2 or any later version.
7 ################################################################################
18 autobuild_branch="autobuild_$(date +%Y%m%d_%H%M%S)"
20 if [ -n "${AUTOBUILD:-}" ] ; then
23 git checkout -b "$autobuild_branch"
25 if git status --porcelain | grep -q '^?? '; then
26 printf "Uncommited changes in current working tree. Please commit/clean up.\n"
31 printf "Building debian/changelog: "
32 if [ -n "${AUTOBUILD:-}" ] ; then
33 # since=$(git show -s --pretty="tformat:%h")
34 eval $(grep '^GRML_LIVE_VERSION=' grml-live)
38 cat > debian/changelog << EOF
39 grml-live (${GRML_LIVE_VERSION}~autobuild${UNIXTIME}) UNRELEASED; urgency=low
41 * Automatically built package based on the state of
42 git repository at http://git.grml.org/?p=grml-live.git
45 $(git log --format=oneline -1)
47 -- grml-live Auto Build <grml-live-git@$(hostname)> $DATE
50 git add debian/changelog
51 git commit -m "Releasing ${GRML_LIVE_VERSION}-~autobuild${UNIXTIME} (auto build)"
53 since=v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')
54 git-dch --ignore-branch --since=$since \
55 --id-length=7 --meta --multimaint-merge -S
59 if [ -z "${AUTOBUILD:-}" ] ; then
60 if ! $EDITOR debian/changelog ; then
61 printf "Exiting as editing debian/changelog returned an error." >&2
66 debian_version="$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')"
69 if echo "$debian_version" | grep -q '\.gbp' ; then
70 printf "Building snapshot version, not releasing.\n"
74 printf "Updating GRML_LIVE_VERSION string in grml-live script: "
75 sed -i "s/^GRML_LIVE_VERSION=.*/GRML_LIVE_VERSION='$debian_version'/" grml-live
78 printf "Comparing versions of debian/changelog with grml-live version string: "
79 script_version="$(awk -F= '/^GRML_LIVE_VERSION=/ {print $2}' grml-live | sed "s/'//g")"
80 debian_version="$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')"
82 if [[ "$script_version" == "$debian_version" ]] ; then
86 printf "Debian package version ($debian_version) does not match script version ($script_version).\n"
90 if $dorelease || [ -n "${AUTOBUILD:-}" ] ; then
91 git add debian/changelog grml-live
92 git commit -s -m "Release new version ${debian_version}."
95 printf "Building debian packages:\n"
96 if [ -n "${AUTOBUILD:-}" ] ; then
97 [ -d ../grml-live.build-area ] || mkdir ../grml-live.build-area
98 rm -rf ../grml-live.build-area/grml-live* # otherwise we're keeping files forever...
99 git-buildpackage --git-ignore-branch --git-ignore-new --git-export-dir=../grml-live.build-area -us -uc
101 git-buildpackage --git-ignore-branch --git-ignore-new $*
102 printf "Finished execution of $(basename $0). Do not forget to tag release ${debian_version}\n"
105 if [ -n "${AUTOBUILD:-}" ] ; then
107 cd ../grml-live.build-area
108 dpkg-scanpackages . /dev/null > Packages
111 git branch -D ${autobuild_branch} || true
113 PACKAGES=$(dpkg --list grml-live\* | awk '/^ii/ {print $2}')
114 sudo apt-get -y --allow-unauthenticated install $PACKAGES
117 ## END OF FILE #################################################################