summaryrefslogtreecommitdiff
path: root/src/query.sh
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-06-06 18:39:20 +0100
committerdavidovski <david@davidovski.xyz>2022-06-06 18:39:20 +0100
commitdd8004ccbf58b546f48205d2878d9101bbfcaadc (patch)
tree7864c5224a4728a37f858f3703e05286bb6a2687 /src/query.sh
parenta8c14970881292501f40c3cf1f5c36b71525fee0 (diff)
fixed sort to be faster
Diffstat (limited to 'src/query.sh')
-rw-r--r--src/query.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/query.sh b/src/query.sh
index 5f863a6..f47ea60 100644
--- a/src/query.sh
+++ b/src/query.sh
@@ -35,16 +35,22 @@ files () {
file_info () {
for file in $@; do
[ ! -f ${SYSROOT}$file ] && file=$(realpath $file 2>/dev/null)
+ local found=false
for pkg in $(installed); do
for list in ${INSTALLED_DIR}/$pkg/files; do
[ -f $list ] && {
-
grep -q "^/usr${file}$" $list || grep -q "^${file}$" $list && {
${QUIET} && echo $pkg || printf "${LIGHT_BLUE}%s${BLUE} belongs to ${LIGHT_BLUE}%s${RESET}\n" $file $pkg
+ found=true
}
}
done
done
+ $found || {
+ printf "${RED}$file does not belong to any package!\n" > /dev/stderr
+ return 1
+ }
+
done
}