-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-wrapper.sh
More file actions
executable file
·45 lines (39 loc) · 1.18 KB
/
build-wrapper.sh
File metadata and controls
executable file
·45 lines (39 loc) · 1.18 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
os_name=`uname -s`
RUN_ARGS=""
if [ "$os_name" = "FreeBSD" ]; then
if ! which podman > /dev/null; then
echo "Must have Podman installed for FreeBSD!"
exit 1
fi
if ! which sudo > /dev/null; then
echo "Only 'sudo' is supported for priviledge escalation. This is required as Podman does not support rootless operation on FreeBSD."
exit 1
fi
COMMAND="sudo podman"
# We need to use Linuxulator on FreeBSD
RUN_ARGS="--os linux"
else
if which docker > /dev/null; then
# Assume user has permissions
COMMAND="docker"
elif which podman > /dev/null; then
# Assume rootless is supported
COMMAND="podman"
else
echo "Must have either Docker or Podman installed!"
exit 1
fi
fi
TARGET=${LAMBDA_TARGET:-i686-elf}
TAG=${LAMBDA_TAG:-latest}
$COMMAND run $RUN_ARGS \
-it --rm \
-v ${PWD}:/code:rw \
-w /code \
-u $(id -u):$(id -g) \
-e CROSS_COMPILE="/opt/lambda-cross/bin/$TARGET-" \
-e HOST_CC="gcc" \
-e HOST_AR="ar" \
git.pfarley.dev/lambda-os/builder:$TAG-$TARGET \
"$@"