Skip to content

Commit

Permalink
Fixed issue with mlocate. Now tomb accepts also plocate for search/in…
Browse files Browse the repository at this point in the history
…dex.
  • Loading branch information
nerun committed Jun 26, 2023
1 parent e316ef2 commit d8bf45e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tomb
Original file line number Diff line number Diff line change
Expand Up @@ -2813,13 +2813,13 @@ BEGIN { }
# $1 is optional, to specify a tomb
index_tombs() {
{ command -v updatedb 1>/dev/null 2>/dev/null } || {
_failure "Cannot index tombs on this system: updatedb (mlocate) not installed." }
_failure "Cannot index tombs on this system: updatedb (mlocate/plocate) not installed." }

updatedbver=`updatedb --version | grep '^updatedb'`
[[ "$updatedbver" =~ "GNU findutils" ]] && {
_warning "Cannot use GNU findutils for index/search commands." }
[[ "$updatedbver" =~ "mlocate" ]] || {
_failure "Index command needs 'mlocate' to be installed." }
[[ "$updatedbver" =~ "locate" ]] || {
_failure "Index command needs 'mlocate/plocate' to be installed." }

_verbose "$updatedbver"

Expand Down Expand Up @@ -2930,13 +2930,13 @@ EOF

search_tombs() {
{ command -v locate 1>/dev/null 2>/dev/null } || {
_failure "Cannot index tombs on this system: updatedb (mlocate) not installed." }
_failure "Cannot index tombs on this system: updatedb (mlocate/plocate) not installed." }

updatedbver=`updatedb --version | grep '^updatedb'`
[[ "$updatedbver" =~ "GNU findutils" ]] && {
_warning "Cannot use GNU findutils for index/search commands." }
[[ "$updatedbver" =~ "mlocate" ]] || {
_failure "Index command needs 'mlocate' to be installed." }
[[ "$updatedbver" =~ "locate" ]] || {
_failure "Index command needs 'mlocate/plocate' to be installed." }

_verbose "$updatedbver"

Expand All @@ -2952,7 +2952,7 @@ search_tombs() {
tombname=${t[(ws:;:)5]}
tombmount="${t[(ws:;:)2]}"
[[ -r "${tombmount}/.updatedb" ]] && {
# Use mlocate to search hits on filenames
# Use mlocate/plocate to search hits on filenames
_message "Searching filenames in tomb ::1 tomb name::" $tombname
locate -d "${tombmount}/.updatedb" -e -i "${(f)@}"
_message "Matches found: ::1 matches::" \
Expand Down

0 comments on commit d8bf45e

Please sign in to comment.