Update snapshot_history.txt
[platform/upstream/iotivity.git] / build-da-checkout.sh
1 #!/bin/bash
2
3 # For Git
4 FETCH_CMD="git fetch -p"
5 CHECKOUT_CMD="git checkout -f "
6
7 msg_hello()
8 {
9     echo "***********************************************************************"
10     echo "*                                                                     *"
11     echo "*                         IoTivity Checkout Start.                    *"
12     echo "*                                                                     *"
13     echo "***********************************************************************"
14 }
15
16 msg_error()
17 {
18     echo ---------------------------------------------------------------------
19     echo "Fail to Build, Check Last Step. [$_STEP]"
20     echo ---------------------------------------------------------------------
21     exit 2
22 }
23
24 error_check()
25 {
26     if [ $? != 0 ]
27     then
28        msg_error
29     fi
30 }
31
32 _STEP=INIT
33 if [ ! -d resource/csdk ];then
34     echo "Please check the pwd."
35     msg_error
36 fi
37
38 # Check commit_info
39 _STEP=COMMIT
40 if [ "" = "$1" ];then
41     msg_error
42 fi
43 COMMIT_ID=$(awk '/^commit_id:/{print $2}' "$1")
44 echo COMMIT ID is $COMMIT_ID
45 error_check
46 if [ 0 == ${#COMMIT_ID} ];then
47     msg_error
48 fi
49
50 _STEP=FETCH
51 echo $FETCH_CMD
52 $FETCH_CMD
53 error_check
54
55 _STEP=CHECKOUT
56 echo $CHECKOUT_CMD $COMMIT_ID
57 $CHECKOUT_CMD $COMMIT_ID
58 error_check