2 # Filename: scripts/release_helper.sh
3 # Purpose: helper script to build grml-live Debian packages (WFM style though)
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 -- grml-live Auto Build <mika@grml.org> $DATE
48 git add debian/changelog
49 git commit -m "Releasing ${GRML_LIVE_VERSION}-~autobuild${UNIXTIME} (auto build)"
51 since=v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')
52 git-dch --ignore-branch --since=$since \
53 --id-length=7 --meta --multimaint-merge -S
57 if [ -z "${AUTOBUILD:-}" ] ; then
58 if ! $EDITOR debian/changelog ; then
59 printf "Exiting as editing debian/changelog returned an error." >&2
64 debian_version="$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')"
67 if echo "$debian_version" | grep -q '\.gbp' ; then
68 printf "Building snapshot version, not releasing.\n"
72 printf "Updating GRML_LIVE_VERSION string in grml-live script: "
73 sed -i "s/^GRML_LIVE_VERSION=.*/GRML_LIVE_VERSION='$debian_version'/" grml-live
76 printf "Comparing versions of debian/changelog with grml-live version string: "
77 script_version="$(awk -F= '/^GRML_LIVE_VERSION=/ {print $2}' grml-live | sed "s/'//g")"
78 debian_version="$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')"
80 if [[ "$script_version" == "$debian_version" ]] ; then
84 printf "Debian package version ($debian_version) does not match script version ($script_version).\n"
88 if $dorelease || [ -n "${AUTOBUILD:-}" ] ; then
89 git add debian/changelog grml-live
90 git commit -s -m "Release new version ${debian_version}."
93 printf "Building debian packages:\n"
94 if [ -n "${AUTOBUILD:-}" ] ; then
95 [ -d ../grml-live.build-area ] || mkdir ../grml-live.build-area
96 git-buildpackage --git-ignore-branch --git-ignore-new --git-export-dir=../grml-live.build-area -us -uc
98 git-buildpackage --git-ignore-branch --git-ignore-new $*
99 printf "Finished execution of $(basename $0). Do not forget to tag release ${debian_version}\n"
102 if [ -n "${AUTOBUILD:-}" ] ; then
104 cd ../grml-live.build-area
105 dpkg-scanpackages . /dev/null > Packages
108 git branch -D ${autobuild_branch} || true
110 PACKAGES=$(dpkg --list grml-live\* | awk '/^ii/ {print $2}')
111 apt-get -y --allow-unauthenticated install $PACKAGES
114 ## END OF FILE #################################################################