summaryrefslogtreecommitdiff
path: root/update.template
blob: 517cae3819281c3f39627ea5bbdb7653f29bc65a (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
set -x

SDK_PATH=__SDK_PATH__
SDK_CMD=$SDK_PATH/tools/ide/bin/tizen
SHARE_ROOT=__SHARE_ROOT__
TOOL_PATH=__TOOL_PATH__
WRAPPER_PATH=__WRAPPER_PATH__
PROFILE="__PROFILE__"
PACKAGE_SERVER=__PACKAGE_SERVER__
ABS_CMD=/home/build/abs
TOOL_CMD=/home/build/sdk-build/pkg-cli
ROOTSTRAP_URL=__ROOTSTRAP_URL__

if [ ! -z $TOOL_PATH ]; then
  su - build -c "cp -rf $TOOL_PATH /home/build/"
fi

if [ ! -z $WRAPPER_PATH ]; then
  su - build -c "cp -pf $WRAPPER_PATH/abs $ABS_CMD; chmod +x $ABS_CMD"
fi

LIST="$SDK_CMD list rootstrap "
UPDATER="$SDK_PATH/update-manager/update-manager-cli.bin"

export DISPLAY=:0
su - build -c "df -hT"

if [ -f $UPDATER ]; then
  mylist=`su - build -c "$UPDATER show-repo-info -r $PACKAGE_SERVER -d tizen_3.0 | grep TizenSDK | cut -f 2 -d ' '"`
  IFS=' ' read -r -a snapshot <<< ${mylist}
  if [ ! -z ${snapshot[0]} ]; then
    su - build -c "$UPDATER install WebCLI -r $PACKAGE_SERVER -d tizen_3.0 -s ${snapshot[0]} --remove-installed-sdk"
    for pf in $PROFILE; do
      su - build -c "$UPDATER install `echo "$pf" | awk '{print toupper($0)}'`-3.0-NativeAppDevelopment-CLI -s ${snapshot[0]} --accept-license --remove-installed-sdk"
    done
  fi
else
  UPDATER="$SDK_PATH/package-manager/package-manager-cli.bin"
  #su - build -c "$UPDATER update"
fi

su - build -c "tizen list rootstrap"
su - build -c "tizen version"

rm -rf $SDK_PATH/tools/smart-build-interface/plugins/*-{device,emulator}*{private,public}.20*_*.xml || true
rm -rf $SDK_PATH/platforms/*/*/rootstraps/ || true
rm -rf $SDK_PATH/.info/*private*

wget --no-proxy -P $SHARE_ROOT/ -r -nd -np -R index.html* ${ROOTSTRAP_URL}/ &> /dev/null

rs_list=`ls $SHARE_ROOT | grep .*-rs.*.zip`
if [ $? != 0 ]; then
  exit 6
fi

for tgt in $rs_list; do
  disp_v=`echo ${tgt/-rs/} | sed -rn 's/(.*.private).*/\1/p'`;
  su - build -c "$TOOL_CMD install-file -P $SHARE_ROOT/${tgt} -l $SDK_PATH --force" 
  echo ret_val = "$?"
  if [ "$disp_v"  == `$LIST | grep ${disp_v} | sed -rn 's/(.*.private).*/\1/p'` ];
    then echo "OK"
  else
    echo "Rootstrap update failure"; exit 9
  fi
done

su - build -c "$LIST"
su - build -c "$UPDATER show-info"
su - build -c "rm -rf /home/build/.update-manager/run/*"
su - build -c "rm -rf /home/build/.package-manager/run/*"
su - build -c "df -hT"