From d7d9486e6ec4d52bc3467c5b82cebc2ad6e5e01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geyslan=20Greg=C3=B3rio?= Date: Tue, 21 May 2024 10:28:32 -0300 Subject: [PATCH] chore: make bpftool installable in alpine linux (#117) --- 3rdparty/bpftool.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/3rdparty/bpftool.sh b/3rdparty/bpftool.sh index 0edd6bd0..f679a540 100755 --- a/3rdparty/bpftool.sh +++ b/3rdparty/bpftool.sh @@ -1,8 +1,25 @@ #!/bin/bash -e +if [ ! -f /etc/os-release ]; then + echo "Unknown OS" + exit 1 +fi + +# shellcheck source=/dev/null +# See SC1091 +. /etc/os-release + +if [ "$ID" == "alpine" ]; then + sudo apk add build-base elfutils-dev zlib-dev libcap-dev binutils-dev pkgconf libelf +elif [ "$ID" == "ubuntu" ]; then + sudo apt-get -y install build-essential libelf-dev libz-dev libcap-dev binutils-dev pkg-config libelf1 +else + echo "Unsupported OS" + exit 1 +fi + git submodule update --init --recursive 3rdparty/bpftool cd ./3rdparty/bpftool -sudo apt-get -y install build-essential libelf-dev libz-dev libcap-dev binutils-dev pkg-config libelf1 make -C src clean CC=clang make -C src all sudo cp ./src/bpftool /usr/sbin/bpftool