Skip to content

Instantly share code, notes, and snippets.

@arbal
Last active March 10, 2021 06:02
Show Gist options
  • Save arbal/a6610ed81346d96b2b33b34b77e1c4b1 to your computer and use it in GitHub Desktop.
Save arbal/a6610ed81346d96b2b33b34b77e1c4b1 to your computer and use it in GitHub Desktop.
brew-install-dublin-traceroute-with-setuid.sh
#!/usr/bin/env bash
set -euo pipefail
# brew-install-dublin-traceroute--HEAD-with-root-setuid.sh
#
# Ask for sudo password here instead of after building dublin-traceroute, for convenience.
sudo -v
# In case homebrew version, 0.4.2, is already installed, uninstall it.
brew uninstall --force dublin-traceroute || true
# Fetch latest homebrew + formulas
brew update
# Requires libtins & jsoncpp. Install with 'brew install libtins jsoncpp'
brew install --HEAD nxmatic/repo/dublin-traceroute
symlink="$(which dublin-traceroute)"
# Changes need to be made to the target of homebrew's symlink, not the symlink
# These two lines don't work
# sudo chmod u+s "${symlink}"
# sudo chown root:wheel "${symlink}"
# Canonicalize the symlink target.
# Install coreutils if greadlink is missing with 'brew install coreutils'
target="$(greadlink -f "${symlink}")"
sudo chmod u+s "${target}"
sudo chown root:wheel "${target}"
# Try it out. Should be v0.5.0 or later.
dublin-traceroute --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment