This repository has been archived by the owner on Aug 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openxt_setup.sh
executable file
·70 lines (63 loc) · 2.88 KB
/
openxt_setup.sh
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
#!/bin/sh
DL_DIR=/mnt/openembedded/downloads
SLAVE_ROOT=/var/lib/buildbot/slaves
OPENXT_BUILD=${SLAVE_ROOT}/openxt/build
OPENXT_CONF_SRC=${OPENXT_BUILD}/example-config
OPENXT_CONF_DST=${OPENXT_BUILD}/.config
OPENXT_CERTDIR=${SLAVE_ROOT}/openxt_certs
REPO_PROD_CACERT="${OPENXT_CERTDIR}/prod-cacert.pem"
REPO_DEV_CACERT="${OPENXT_CERTDIR}/dev-cacert.pem"
REPO_DEV_SIGNING_CERT="${OPENXT_CERTDIR}/dev-cacert.pem"
REPO_DEV_SIGNING_KEY="${OPENXT_CERTDIR}/dev-cakey.pem"
CORES_TWICE=$(($(nproc)*2))
OPENXT_NAME_SITE="${1:-autobuilder}"
OPENXT_BUILD_TYPE="${2:-dev}"
# positional arguments are bad, use getopt
OPENXT_BUILD_ID="${3:-noid}"
OPENXT_BRANCH="${4:-master}"
# Setting the above build variables triggers the tagging logic in the
# do_build.sh script. Basically it assumes there's a tag in the git repos
# taht matches some mash-up of these 4 variables. Fall back to master by
# setting the following variable.
ALLOW_SWITCH_BRANCH_FAIL='true'
# values we'll be setting in local.conf
DL_DIR="/mnt/openembedded/downloads/"
OPENXT_GIT_MIRROR="/var/lib/git/openxt"
OE_GIT_MIRROR="file:///var/lib/git"
OPENXT_GIT_PROTOCOL="file"
if [ ! -f ${CORE_CONF_SRC} ]; then
echo "Missing example config file for OpenXT. Halting."
exit 1
fi
EQUALITY_REGEX='\?=\|\+=\|=\+\|='
# set variables in config
cat "${OPENXT_CONF_SRC}" | sed \
-e "s&^\([[:space:]]*OPENXT_GIT_MIRROR[[:space:]]*\)\(${EQUALITY_REGEX}\).*$&\1\2\"${OPENXT_GIT_MIRROR}\"&" \
-e "s&^\([[:space:]]*OPENXT_GIT_PROTOCOL[[:space:]]*\)\(${EQUALITY_REGEX}\).*$&\1\2\"${OPENXT_GIT_PROTOCOL}\"&" \
-e "s&^\([[:space:]]*OE_GIT_MIRROR[[:space:]]*\)\(${EQUALITY_REGEX}\).*$&\1\2\"${OE_GIT_MIRROR}\"&" \
-e "s&^\([[:space:]]*REPO_PROD_CACERT[[:space:]]*\)\(${EQUALITY_REGEX}\).*$&\1\2\"${REPO_PROD_CACERT}\"&" \
-e "s&^\([[:space:]]*REPO_DEV_CACERT[[:space:]]*\)\(${EQUALITY_REGEX}\).*$&\1\2\"${REPO_DEV_CACERT}\"&" \
-e "s&^\([[:space:]]*REPO_DEV_SIGNING_CERT[[:space:]]*\)\(${EQUALITY_REGEX}\)&\1\2\"${REPO_DEV_SIGNING_CERT}\"&" \
-e "s&^\([[:space:]]*REPO_DEV_SIGNING_KEY[[:space:]]*\)\(${EQUALITY_REGEX}\)&\1\2\"${REPO_DEV_SIGNING_KEY}\"&" \
-e "s&^\([[:space:]]*NAME_SITE[[:space:]]*\)\(${EQUALITY_REGEX}\).*$&\1\2\"${OPENXT_NAME_SITE}\"&" \
-e "s&^\([[:space:]]*BUILD_TYPE[[:space:]]*\)\(${EQUALITY_REGEX}\).*$&\1\2\"${OPENXT_BUILD_TYPE}\"&" \
-e "s&^\([[:space:]]*BRANCH[[:space:]]*\)\(${EQUALITY_REGEX}\).*$&\1\2\"${OPENXT_BRANCH}\"&" \
> ${OPENXT_CONF_DST}
if [ $? -ne 0 ]; then
exit $?
fi
echo "OE_BUILD_CACHE_DL=\"${DL_DIR}\"" >> ${OPENXT_CONF_DST}
if [ $? -ne 0 ]; then
exit $?
fi
echo "ID=\"${OPENXT_BUILD_ID}\"" >> ${OPENXT_CONF_DST}
if [ $? -ne 0 ]; then
exit $?
fi
echo "OE_BB_THREADS=\"${CORES_TWICE}\"" >> ${OPENXT_CONF_DST}
if [ ! -z "${ALLOW_SWITCH_BRANCH_FAIL}" ]; then
echo "ALLOW_SWITCH_BRANCH_FAIL=\"${ALLOW_SWITCH_BRANCH_FAIL}\"" >> ${OPENXT_CONF_DST}
if [ $? -ne 0 ]; then
exit $?
fi
fi