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