-
Notifications
You must be signed in to change notification settings - Fork 10
/
docker_build.sh
executable file
·34 lines (29 loc) · 1.02 KB
/
docker_build.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
#!/bin/bash
# SPDX-FileCopyrightText: 2020, Carles Fernandez-Prades <[email protected]>
# SPDX-License-Identifier: MIT
# Default version 2019.1
XILVER=${1:-2019.1}
# Default Vivado build number
XXXX_XXXX=${2:-0524_1430}
# Check if the petalinux installer exists
PLNX="resources/petalinux-v${XILVER}-final-installer.run"
if [ ! -f "$PLNX" ] ; then
echo "$PLNX installer not found"
exit 1
fi
# Check HTTP server is running
PYTHONV=$(python --version 2>&1 | cut -f2 -d' ')
case $PYTHONV in
3*) PYTHONHTTP="http.server" ;;
*) PYTHONHTTP="SimpleHTTPServer" ;;
esac
# shellcheck disable=SC2009
if ! ps -fC python | grep "$PYTHONHTTP" > /dev/null ; then
python -m "$PYTHONHTTP" &
HTTPID=$!
echo "HTTP Server started as PID $HTTPID"
trap 'kill $HTTPID' EXIT QUIT SEGV INT HUP TERM ERR
fi
echo "Creating Docker image petalinux:$XILVER..."
time docker build . -t petalinux:"$XILVER" --build-arg XILVER="${XILVER}" --build-arg XXXX_XXXX="${XXXX_XXXX}"
[ -n "$HTTPID" ] && kill $HTTPID && echo "Killed HTTP Server"