1#!/bin/bash
2
3# Build an original tar-ball for a debian package free of a debian directory and
4# .git.
5
6version=`head -1 debian/changelog | sed 's/.*(//
7     s/-.*//'`
8sed -i "s/LIB_TAG=.*/LIB_TAG=$version/" Makefile
9if [ "`basename $PWD`" != "sonic-$version" ]; then
10    echo "Directory name should be sonic-$version"
11    exit 1
12fi
13make clean
14make -f debian/rules clean
15echo "sonic_${version} (git: `git log -1 --oneline | sed 's/ .*//'`)" > version
16git2cl > ChangeLog
17cd ..
18if ! tar -cvzf sonic_$version.orig.tar.gz --exclude-vcs --exclude=debian sonic-$version; then
19    echo "Could not create sonic_$version.orig.tar.gz"
20    exit 1
21fi
22echo "Successfully created sonic_$version.orig.tar.gz"
23