summaryrefslogtreecommitdiffstats
path: root/build-root/scripts/verdist
blob: 9d1f1b5adcdb86e933edcd2b7cc6938e531298df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

#
# Add version to dist tarball.
#
BR=$1
prefix=$2
verstring=$3
BASE=`pwd`

git rev-parse 2> /dev/null
if [ $? == 0 ]; then
    git archive --prefix=${prefix}/ HEAD | gzip -9 > ${verstring}.tar.gz
else
    cd ..
    tar -c ${prefix} | gzip -9 > ${verstring}.tar.gz
    cp ${verstring}.tar.gz $BASE
    cd $BASE
fi

mkdir ${BASE}/tmp
cd ${BASE}/tmp
tar -xzf ${BASE}/${verstring}.tar.gz
rm ${BASE}/${verstring}.tar.gz

cp ${BR}/scripts/.version ${BASE}/tmp/${prefix}/build-root/scripts
tar -c ${prefix} | gzip -9 > ${verstring}.tar.gz
mv ${verstring}.tar.gz ${BASE}

cd ${BASE}
rm -rf tmp