mirror of
https://github.com/JakeHillion/scx.git
synced 2024-11-25 19:10:23 +00:00
273728fd2b
When fetching external git repositories (libbpf and bpftool) we don't check if the target commit exists. This can leads to issues such as #400, because we may silently use HEAD, instead of the specified commit. Prevent this by returning an error when the target SHA1 cannot be found. Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
20 lines
370 B
Bash
20 lines
370 B
Bash
#!/bin/bash
|
|
|
|
URL=https://github.com/libbpf/libbpf.git
|
|
|
|
unset CDPATH
|
|
cd $1
|
|
rm -rf libbpf
|
|
git clone --depth=1 ${URL}
|
|
cd libbpf
|
|
git fetch --depth=1 origin $2 || {
|
|
echo "commit $2 does not exists in ${URL}"
|
|
exit 1
|
|
}
|
|
git checkout $2
|
|
|
|
# This is needed because we haven't built libbpf yet
|
|
# and this is where the headers will end up
|
|
mkdir src/usr
|
|
mkdir src/usr/include
|