From 3112e856ae01b7c10e6fd05fd22b9312eedf5c91 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 14 Apr 2021 13:32:41 -0400 Subject: [PATCH] chore: fix install script --- install_perf.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/install_perf.sh b/install_perf.sh index cf45953..e7705da 100755 --- a/install_perf.sh +++ b/install_perf.sh @@ -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