chore: fix install script

main
Sean McBride 4 years ago
parent db0c3504c0
commit 3112e856ae

@ -1,7 +1,10 @@
#!/bin/bash
# If already installed, just return
[[ -x perf ]] && return 0
command -v perf && {
echo "perf is already installed."
exit 0
}
[[ "$(whoami)" != "root" ]] && {
echo "Expected to run as root"
@ -11,14 +14,11 @@
# Under WSL2, perf has to be installed from source
if grep --silent 'WSL2' <(uname -r); then
echo "WSL detected. perf must be built from source"
echo "WSL2 support is WIP and not currently functional"
exit 0
sudo apt-get install flex bison python3-dev liblzma-dev libnuma-dev zlib1g libperl-dev libgtk2.0-dev libslang2-dev systemtap-sdt-dev libelf-dev binutils-dev libbabeltrace-dev libdw-dev libunwind-dev libiberty-dev --yes
git clone --depth 1 https://github.com/microsoft/WSL2-Linux-Kernel ~/WSL2-Linux-Kernel
make -Wno-error -j8 -C ~/WSL2-Linux-Kernel/tools/perf
sudo cp ~/WSL2-Linux-Kernel/tools/perf/perf /usr/local/bin
# rm -rf ~/WSL2-Linux-Kernel
rm -rf ~/WSL2-Linux-Kernel
else
apt-get install "linux-tools-$(uname -r)" linux-tools-generic -y
fi

Loading…
Cancel
Save