-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild.sh
executable file
·61 lines (50 loc) · 1.03 KB
/
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
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
#!/bin/sh
set -e
log() {
printf "%s\n" "${1}"
}
error() {
log "ERROR: ${1}"
}
fail() {
log "FATAL: ${1}"
exit 1
}
if [ "$#" -eq 0 ]; then
log "Usage: $(basename "$0") <kernel_version> [<libc>] [<os>]"
exit 1
fi
KERNEL_VERSION="${1}"
LIBC="${2:-glibc}"
OS="${3:-generic}"
TAG="kernel-collector:$(echo "${KERNEL_VERSION}" | tr '.' '_')_${LIBC}_${OS}"
# Treat a LIBC=static as a static build (STATIC=1)
if [ "$LIBC" = "static" ]; then
STATIC=1
export STATIC
fi
git clean -d -f -x
docker build \
-f Dockerfile."${LIBC}"."${OS}" \
-t "${TAG}" \
--build-arg KERNEL_VERSION="${KERNEL_VERSION}" \
./ | tee prepare.log
if [ -t 1 ]; then
docker run \
-i -t --rm \
-v "$PWD":/kernel-collector \
-w /kernel-collector \
--security-opt seccomp=unconfined \
-e DEBUG \
-e STATIC \
"${TAG}" | tee build.log
else
docker run \
--rm \
-v "$PWD":/kernel-collector \
-w /kernel-collector \
--security-opt seccomp=unconfined \
-e DEBUG \
-e STATIC \
"${TAG}" | tee build.log
fi