#!/bin/sh
# Runs as root after the files are in place. Puts /usr/local/bin on the PATH of the person who installed tmux
# (update-shell-profile.sh, which they can run again), as Git's installer does for its folder.
# Installer.app sets USER to that person. Tiger's "sudo installer" passes on neither SUDO_USER nor USER (it is
# root), but HOME is still the person's own: its owner is the one.
U=${SUDO_USER:-$USER}
if [ -z "$U" ] || [ "$U" = root ]; then
  U=$(/usr/bin/stat -f %Su "$HOME" 2>/dev/null)
fi
[ -n "$U" ] && [ "$U" != root ] || exit 0
/usr/bin/sudo -u "$U" -H /bin/sh /usr/local/share/doc/tmux-tiger/update-shell-profile.sh >/dev/null 2>&1 || true
exit 0
