blob: 9d1f1b5adcdb86e933edcd2b7cc6938e531298df [file] [log] [blame]
Thomas F Herbert20a29c72016-10-13 18:36:50 -04001#!/bin/bash
2
3#
4# Add version to dist tarball.
5#
6BR=$1
7prefix=$2
8verstring=$3
9BASE=`pwd`
10
11git rev-parse 2> /dev/null
12if [ $? == 0 ]; then
13 git archive --prefix=${prefix}/ HEAD | gzip -9 > ${verstring}.tar.gz
14else
15 cd ..
16 tar -c ${prefix} | gzip -9 > ${verstring}.tar.gz
17 cp ${verstring}.tar.gz $BASE
18 cd $BASE
19fi
20
21mkdir ${BASE}/tmp
22cd ${BASE}/tmp
23tar -xzf ${BASE}/${verstring}.tar.gz
24rm ${BASE}/${verstring}.tar.gz
25
26cp ${BR}/scripts/.version ${BASE}/tmp/${prefix}/build-root/scripts
27tar -c ${prefix} | gzip -9 > ${verstring}.tar.gz
28mv ${verstring}.tar.gz ${BASE}
29
30cd ${BASE}
31rm -rf tmp