Created
May 9, 2020 07:12
-
-
Save dialogbox/c3f633c564855f778345316e1cd6d6c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
source /etc/os-release | |
if [ "$ID" = "debian" ] || [ "$ID" = "ubuntu" ]; then | |
sudo apt-get install -y linux-headers-$(uname -r) | |
sudo docker run -ti -v /usr/src:/usr/src:ro \ | |
-v /lib/modules/:/lib/modules:ro \ | |
-v /sys/kernel/debug/:/sys/kernel/debug:rw \ | |
--net=host --pid=host --privileged \ | |
quay.io/iovisor/bpftrace:latest | |
elif [ "$ID" = "cos" ]; then | |
if [ ! -d "/tmp/kernel_headers" ]; then | |
wget https://storage.googleapis.com/cos-tools/${BUILD_ID}/kernel-headers.tgz -P /tmp/ | |
mkdir /tmp/kernel_headers | |
tar -zxvf /tmp/kernel-headers.tgz -C /tmp/kernel_headers/ | |
fi | |
docker run --rm -it --env BPFTRACE_KERNEL_SOURCE=/tmp/kernel_headers/usr/src/linux-headers-$(uname -r) \ | |
-v /sys/kernel/debug:/sys/kernel/debug \ | |
-v /tmp/kernel_headers:/tmp/kernel_headers \ | |
--privileged \ | |
quay.io/iovisor/bpftrace:latest | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bash -c "$(curl -sSL -H "Cache-Control: no-cache" https://gist.github.com/dialogbox/c3f633c564855f778345316e1cd6d6c2/raw?$(date +%s))"