From f42a1a5908b2c6ded766256271a7ffaf2f133105 Mon Sep 17 00:00:00 2001 From: Herbert Wolverson Date: Tue, 21 Mar 2023 13:17:46 +0000 Subject: [PATCH] build_rust.sh checks for dependencies On start, the "build_rust.sh" script checks for the availability of bpftool, pkg-config and clang/LLVM. If these aren't found, it fires up an "apt-get install" for the appropriate packages. --- src/build_rust.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/build_rust.sh b/src/build_rust.sh index 1fff200e..cc5547eb 100755 --- a/src/build_rust.sh +++ b/src/build_rust.sh @@ -8,6 +8,34 @@ # # Don't forget to setup `/etc/lqos.conf` +# Check Pre-Requisites +if ! bpftool help &> /dev/null +then + echo "bpftool is not installed." + echo "Let's try to install it" + sudo apt-get install linux-tools-common linux-tools-`uname -r` +else + echo "bpftool found." +fi + +if ! pkg-config --help &> /dev/null +then + echo "pkg-config is not installed." + echo "Let's try to install it" + sudo apt-get install pkg-config +else + echo "pkg-config found." +fi + +if ! clang -v &> /dev/null +then + echo "LLVM/clang is not installed." + echo "Let's try to install it" + sudo apt-get install llvm libelf-dev gcc gcc-multilib libbpf-dev +else + echo "LLVM/clang found." +fi + # To enable heavy debug mode (slow) #BUILD_FLAGS="" #TARGET=debug