-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
路30 lines (25 loc) 路 1.17 KB
/
Copy pathdocker-entrypoint.sh
File metadata and controls
executable file
路30 lines (25 loc) 路 1.17 KB
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
#!/usr/bin/env bash
set -euo pipefail
# eBPF requires the host kernel's BTF. vmlinux.h is generated from it and the
# uprobes attach against it, so it must be mounted into the container.
if [ ! -e /sys/kernel/btf/vmlinux ]; then
echo "error: /sys/kernel/btf/vmlinux not found." >&2
echo "Run with a BTF-enabled host kernel and the BTF mounted, e.g.:" >&2
echo " docker run --privileged -v /sys/kernel/btf:/sys/kernel/btf:ro ... sqlite-hook ..." >&2
exit 1
fi
# Build the tracer (generates vmlinux.h from the mounted host BTF + the skeleton)
# if the mounted tree doesn't already carry a built binary.
if [ ! -x /app/build/sqlite_trace ]; then
echo "==> building sqlite_trace (vmlinux.h from host BTF + skeleton)" >&2
make -C /app trace >&2
fi
# Loader default for the BTF blobs; the mounted tree's build/btf symlinks into
# .btf-cache. Override with -e SQLITE_TRACE_BTF_DIR=... to point elsewhere.
export SQLITE_TRACE_BTF_DIR="${SQLITE_TRACE_BTF_DIR:-/app/build/btf}"
# `run-tests` runs the full suite (builds libs/demos first); anything else is
# passed straight through to the tracer.
if [ "${1:-}" = "run-tests" ]; then
exec make -C /app test
fi
exec /app/build/sqlite_trace "$@"