forked from kiss-community/kiss
kiss-owns: Allow all path types as input
This commit is contained in:
parent
e98d159366
commit
3237598dc3
@ -1,18 +1,30 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
# Check which package owns a file
|
# Check which package owns a file
|
||||||
|
|
||||||
# Strip 'KISS_ROOT' from the file path if passed and
|
# Follow symlinks to any paths.
|
||||||
# follow symlinks.
|
case $1 in
|
||||||
file=$(readlink -f "$KISS_ROOT/${1##$KISS_ROOT}")
|
/*)
|
||||||
|
cd -P "$KISS_ROOT/${1%/*}"
|
||||||
|
;;
|
||||||
|
|
||||||
[ -f "$file" ] || {
|
*/*)
|
||||||
|
cd -P "${1%/*}"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
cd -P .
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
[ -f "$PWD/${1##*/}" ] || {
|
||||||
printf 'usage: kiss-owns [/path/to/file]\n' >&2
|
printf 'usage: kiss-owns [/path/to/file]\n' >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print the full path to the manifest file which contains
|
# Print the full path to the manifest file which contains
|
||||||
# the match to our search.
|
# the match to our search.
|
||||||
pkg_owns=$(grep -lFx "${file##$KISS_ROOT}" \
|
pkg_owns=$(grep -lFx \
|
||||||
|
"$PWD/${1##*/}" \
|
||||||
"$KISS_ROOT/var/db/kiss/installed/"*/manifest)
|
"$KISS_ROOT/var/db/kiss/installed/"*/manifest)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user