README: update build examples for deprecated and renamed layers
[charm.git] / package-tarball.sh
blob2a305911965d035fe91cc7ab759aa930cb39994a
1 #!/bin/bash
3 # Print commands as they run
4 set -v
6 # Halt on error
7 set -e
9 # Set 'release' mode if requested, influences commitid.sh
10 export RELEASE="0"
11 if [[ $# -gt 0 ]]
12 then
13 arg=$1
14 shift
16 if [ "$arg" = "--release" ]
17 then
18 echo Saw $arg
19 RELEASE="1"
20 else
21 echo "Unrecognized argument '$arg'"
22 exit 1
25 if [[ $# -gt 0 ]]
26 then
27 echo "Unrecognized argument '$arg'"
28 exit 1
32 # Make sure the working copy and index are completely clean
33 git diff --quiet --exit-code HEAD
35 # Emit a static indicator of the original commit
36 pushd src/scripts
37 SRCBASE=`pwd` ./commitid.sh
38 git add -f VERSION
39 rm VERSION.new
40 popd
42 # Stage all of the modified files
43 git add -u
45 # Get an identifier for the current state of the code
46 object_id=`git write-tree`
48 # Construct the target file/folder name
49 version="charm-$(cat src/scripts/VERSION)"
51 # Generate the distribution tarball
52 git archive --format=tar.gz --prefix="$version/" -o $version.tar.gz $object_id
54 # And clean up the mess we made
55 git reset --hard