reset `$sudo` when writing man pages.
This helps ensure that mismatched permission on `_bin_dir` and `_man_dir` don't cause issues. Also prevents creating man pages owned by root being written to the user's $HOME
This commit is contained in:
parent
606b2f41c3
commit
b92ff0489e
12
install.sh
12
install.sh
|
|
@ -148,6 +148,18 @@ main() {
|
|||
}
|
||||
log "Installed zoxide to ${_bin_dir}"
|
||||
|
||||
# After this point, $sudo is used for _bin_dir instead of _bin_dir
|
||||
|
||||
if test_writeable "${_man_dir}"; then
|
||||
log "Installing zoxide man pages, please wait…"
|
||||
_sudo=""
|
||||
else
|
||||
log "Escalated permissions are required to install man pages to ${_man_dir}"
|
||||
elevate_priv "${_sudo:-$SUDO}" # use previously found command OR user defined
|
||||
_sudo=${RETVAL}
|
||||
log "Installing zoxide man pages as root using $_sudo, please wait…"
|
||||
fi
|
||||
|
||||
# Install manpages.
|
||||
# shellcheck disable=SC2086 # The lack of quoting is intentional.
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue