Update release script
authorMichael Buesch <mb@bu3sch.de>
Mon, 19 Apr 2010 15:48:59 +0000 (17:48 +0200)
committerMichael Buesch <mb@bu3sch.de>
Mon, 19 Apr 2010 15:48:59 +0000 (17:48 +0200)
Signed-off-by: Michael Buesch <mb@bu3sch.de>
fwcutter/makerelease.sh

index bcb74e0865b00ccb67666290b76c6029d73efeb9..576070845eba5612f5650f84a790a5f791d8aa57 100755 (executable)
@@ -3,42 +3,51 @@ set -e
 
 project="b43-fwcutter"
 
+origin="$(dirname "$0")"
+[ "${origin:0:1}" = "/" ] || origin="$PWD/$origin"
+
+do_git_tag=1
+[ "$1" = "--notag" ] && do_git_tag=0
 
-origin="$(pwd)"
 version="$(cat $origin/Makefile | grep -e VERSION | head -n1 | cut -d' ' -f3)"
 if [ -z "$version" ]; then
        echo "Could not determine version!"
        exit 1
 fi
+tmpdir="/tmp"
 release_name="$project-$version"
 tarball="$release_name.tar.bz2"
 
 export GIT_DIR="$origin/../.git"
 
-cd /tmp/
-rm -Rf "$release_name"
+rm -Rf "$tmpdir/$release_name"
 echo "Creating target directory"
-mkdir "$release_name"
-cd "$release_name"
+mkdir -p "$tmpdir/$release_name"
+cd "$tmpdir/$release_name"
 echo "git checkout"
 git checkout -f
 mv fwcutter $release_name
-cd $release_name
+targetdir="$tmpdir/$release_name/$release_name"
 
-rm makerelease.sh
+rm "$targetdir/makerelease.sh"
 
 echo "creating tarball"
-cd ..
+cd "$targetdir/.."
 tar cjf "$tarball" "$release_name"
 mv "$tarball" "$origin"
 
 echo "running testbuild"
-cd "$release_name"
+cd "$targetdir"
 make
 
 echo "removing testbuild"
-cd ../..
-rm -R "$release_name"
+rm -R "$tmpdir/$release_name"
+
+if [ "$do_git_tag" -ne 0 ]; then
+       echo "Tagging GIT"
+       cd "$origin"
+       git tag -m "$tagmsg" -a "$tagname"
+fi
 
 echo
 echo "built release $version"