aboutsummaryrefslogtreecommitdiffstats
path: root/jjb/common/include-apps-fetch-install-sdk.sh
blob: 0d23186528c9c4db823df8d8d0a6fd57ee6d7cae (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
74
75
#!/bin/bash
# (c) 2017 Jan-Simon Moeller dl9pf(at)gmx.de
# License GPLv2
#
# debugging purposes
set -e
#set -x

SDKHOSTDIR="~/agl-sdk"

################################################################################
## apps-fetch-install-sdk.sh
################################################################################

# should probably switch to release ... or multiple (release/snapshot) fwiw
if test x"" = x"$AGLBRANCH"; then echo "AGLBRANCH not set, quitting" ; exit 1 ; fi

if test x"albacore" = x"$AGLBRANCH"; then echo "Unsupported branch"; exit 0; fi
if test x"blowfish" = x"$AGLBRANCH"; then echo "Unsupported branch"; exit 0; fi
if test x"chinook" = x"$AGLBRANCH"; then echo "Unsupported branch"; exit 0; fi
if test x"dab" = x"$AGLBRANCH"; then echo "Unsupported branch"; exit 0; fi
set +x

# default to release
SDKBASEURL="http://mirror.automotivelinux.org/AGL/release/${AGLBRANCH}/latest/${TARGETSDKMACHINE}/deploy/sdk/"

# but master uses snapshot
if test x"master" = x"$AGLBRANCH" ; then
  SDKBASEURL="http://mirror.automotivelinux.org/AGL/snapshots/master/latest/${TARGETSDKMACHINE}/deploy/sdk/"
fi
if test x"halibut" = x"$AGLBRANCH" ; then
  SDKBASEURL="http://mirror.automotivelinux.org/AGL/snapshots/halibut/latest/${TARGETSDKMACHINE}/deploy/sdk/"
fi

# special case for dab
if test x"dab" = x"$AGLBRANCH" ; then
  if test x"qemuarm64" = x"$TARGETSDKMACHINE"; then
      echo "Skipping aarch64 .... "
      exit 0
  fi
  SDKBASEURL="http://mirror.automotivelinux.org/AGL/release/dab/latest/${TARGETSDKMACHINE}/deploy/sdk/"
fi



export TARGETSDKNAME=$(curl -s "$SDKBASEURL" | grep -e "crosssdk.*\.sh<" | sed -e "s#.*<a href=\"##g" -e "s#\">poky-agl.*##g")

if test x"" = x"${TARGETSDKNAME}" ; then
    echo "Could not retrieve TARGETSDKNAME from download.automotivelinux.org"
    exit 1
fi
#set -x
if test ! -f ${TARGETSDKNAME} ; then
  echo "Downloading $TARGETSDKNAME for $MACHINE"
  wget -nd -c "${SDKBASEURL}/${TARGETSDKNAME}"
fi

chmod a+x ${TARGETSDKNAME}

if test x"" = x"$(eval ls ${SDKHOSTDIR}/environment-setup* | grep "agl-" | grep ${TARGETSDKARCH} 2>/dev/null)" ; then
  bash ${TARGETSDKNAME} -d ${SDKHOSTDIR}/ -y
fi

# find out the env setup script
export TARGETSDKENVSCRIPT="$(eval ls ${SDKHOSTDIR}/environment-setup* | grep "agl-" | grep ${TARGETSDKARCH} 2>/dev/null)"

if test ! -f ${TARGETSDKENVSCRIPT} ; then
  echo "Script not there after extracting sdk ?!"
  echo "Abort."
  exit 1
fi

echo "About to source ${TARGETSDKENVSCRIPT}"
source "${TARGETSDKENVSCRIPT}"