handle _man_dir writabililty more robustly
This ensures that mismatched permissions/ownership on `${_man_dir}` and `${_man_dir}/man1` don't cause the script to fail.
*If* `${man_dir}/man1` already exists and is writable, OR `${_man_dir}/man1` *doesn't* yet exist, but `${_man_dir}` is
writable, then the script continues without sudo.
If `/man1` doesn't exist, and it's parent isn't writable, we need sudo.
If `/man1` *does* exist, and it's not writable, we need sudo.
This commit is contained in:
parent
b92ff0489e
commit
7d1454e430
|
|
@ -150,7 +150,8 @@ main() {
|
|||
|
||||
# After this point, $sudo is used for _bin_dir instead of _bin_dir
|
||||
|
||||
if test_writeable "${_man_dir}"; then
|
||||
if { [ -d "${_man_dir}/man1" ] && test_writeable "${_man_dir}/man1}"; } ||
|
||||
{ ! [ -d "${_man_dir}/man1" ] && test_writeable "${_man_dir}"; }; then
|
||||
log "Installing zoxide man pages, please wait…"
|
||||
_sudo=""
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue