forked from avengineers/SPLed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap_ubuntu.sh
More file actions
executable file
·44 lines (40 loc) · 1.67 KB
/
Copy pathbootstrap_ubuntu.sh
File metadata and controls
executable file
·44 lines (40 loc) · 1.67 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
#!/bin/bash
# Root-level OS prerequisites for SPLed on Ubuntu/Debian.
# Installs the apt packages the poks toolchain and build.sh assume are present
# but do not install themselves. Requires root:
# - the devcontainer Dockerfile invokes it via RUN (root at build time)
# - on a bare WSL/Ubuntu host, run it with: sudo ./bootstrap_ubuntu.sh
# Proxy / cert / apt-mirror setup is NOT handled here (Dockerfile-only concern);
# a bare host is assumed to already trust the corporate CA and have working apt.
#
# Usage: bootstrap_ubuntu.sh [--clean-apt-cache]
# --clean-apt-cache Drop the apt lists afterwards to keep the image layer small.
# Image builds only -- passing it on a bare host would just force
# the user's next unrelated `apt install` to re-fetch the lists.
# (Passed explicitly rather than auto-detected: BuildKit does not
# create /.dockerenv in RUN steps, and cgroup v2 shows only "0::/",
# so there is no reliable "am I in an image build" probe.)
set -euo pipefail
clean_apt_cache=false
for arg in "$@"; do
case "$arg" in
--clean-apt-cache) clean_apt_cache=true ;;
*) echo "bootstrap_ubuntu.sh: unknown argument '$arg'" >&2; exit 1 ;;
esac
done
if [ "$(id -u)" -ne 0 ]; then
echo "bootstrap_ubuntu.sh installs apt packages and must run as root." >&2
echo "On a bare host run: sudo ./bootstrap_ubuntu.sh" >&2
exit 1
fi
apt-get update
apt-get install -y --no-install-recommends \
libc6-dev \
build-essential \
7zip \
pipx \
python3-venv
if [ "$clean_apt_cache" = true ]; then
apt-get clean
rm -rf /var/lib/apt/lists/*
fi