build: Suggest to download supported tinycbor
[platform/upstream/iotivity.git] / extlibs / tinycbor / prep.sh
1 #!/bin/sh
2
3 set -e
4
5 # Keep cborRevision in sync with extlibs/tinycbor/SConscript's setting. Right now this script
6 # assumes cborRevision is a tag; comment out the second clause if cborRevision becomes
7 # a branch or a specific commit.
8 cborUrl="https://github.com/01org/tinycbor"
9 cborDir="./extlibs/tinycbor/tinycbor"
10 cborRevision="v0.4"
11 if [ ! -d ${cborDir} ]; then
12     echo ""
13     echo "*********************************** Error: ****************************************"
14     echo "* Please download TinyCBOR using the following command:                           *"
15     echo "*     $ git clone ${cborUrl} ${cborDir} -b ${cborRevision} "
16     echo "***********************************************************************************"
17     echo ""
18     exit
19 elif [ ! -z $(git tag -l $cborRevision) ]; then
20     echo ""
21     echo "*********************************** Error: *******************************************"
22     echo "* TinyCBOR repo is out of date. Please update TinyCBOR using the following commands: *"
23     echo "*     $ cd (authoritative TinyCBOR source repo location)                             *"
24     echo "*     $ git fetch                                                                    *"
25     echo "**************************************************************************************"
26     echo ""
27     exit
28 elif [ -d ${cborDir}/.git ]; then
29     cd ${cborDir}
30     git reset --hard ${cborRevision}
31     cd -
32     rm -rf ${cborDir}/.git*
33 else
34     echo "Assuming TinyCBOR is already on correct revision ${cborRevision}"
35 fi