install-strace.sh 761 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env bash
  2. set -euxo pipefail
  3. install_strace() {
  4. case "${OSTYPE}" in
  5. linux*)
  6. if ! strace -qq -k -e trace=exit /bin/true 2> /dev/null; then
  7. (
  8. set +x
  9. echo "This Linux distribution doesn't appear to support strace -k." \
  10. "Attempting to build & install a recent version..." 1>&2
  11. git -c advice.detachedHead=false clone -q --depth=1 -b v5.5 \
  12. "https://github.com/strace/strace"
  13. cd strace
  14. ./bootstrap
  15. CPPFLAGS="-w ${CPPFLAGS-}" ./configure --quiet --with-libunwind --enable-mpers=no
  16. make -s -j"$(getconf _NPROCESSORS_ONLN || echo 1)"
  17. sudo make -s install
  18. )
  19. fi > /dev/null;;
  20. *) false;;
  21. esac
  22. }
  23. install_strace "$@"