kiss: Support POSIX find in pkg_find
This commit is contained in:
parent
ea9dc1278a
commit
1e4f9e89b2
10
kiss
10
kiss
|
@ -182,13 +182,19 @@ pkg_find() {
|
||||||
query=$1
|
query=$1
|
||||||
match=$2
|
match=$2
|
||||||
|
|
||||||
|
# This ugly mess appends '/.' to the end of each path in
|
||||||
|
# '$KISS_PATH' as POSIX 'find' has no '-mindepth'/'-maxdepth'.
|
||||||
|
# See: https://unix.stackexchange.com/a/330372
|
||||||
|
IFS=:; set --
|
||||||
|
for path in $KISS_PATH; do set "$@" "$path/."; done
|
||||||
|
IFS=$old_ifs
|
||||||
|
|
||||||
# Find the repository containing a package.
|
# Find the repository containing a package.
|
||||||
# Searches installed packages if the package is absent
|
# Searches installed packages if the package is absent
|
||||||
# from the repositories.
|
# from the repositories.
|
||||||
# See [1] at top of script.
|
# See [1] at top of script.
|
||||||
# shellcheck disable=2046,2086
|
# shellcheck disable=2046,2086
|
||||||
set -- $(IFS=:
|
set -- $(find "$@" "$sys_db/." \( ! -name . -prune \) -name "$query")
|
||||||
find $KISS_PATH "$sys_db" -mindepth 1 -maxdepth 1 -name "$1")
|
|
||||||
|
|
||||||
# A package may also not be found due to a repository not being
|
# A package may also not be found due to a repository not being
|
||||||
# readable by the current user. Either way, we need to die here.
|
# readable by the current user. Either way, we need to die here.
|
||||||
|
|
Loading…
Reference in New Issue