aboutsummaryrefslogtreecommitdiff
path: root/contrib/kiss-owns
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-05-14 14:08:17 +0000
committermerakor <cem@ckyln.com>2020-05-14 14:08:17 +0000
commit4a4255350812f1ecebb6f6e22d9300ad5eb0ce2e (patch)
tree6d00fd7a2f444fe3a55a9b25d750e60ec696d635 /contrib/kiss-owns
parent0f9b1f4c75317680989aa4a44a32e6efe256dd56 (diff)
downloadcpt-4a4255350812f1ecebb6f6e22d9300ad5eb0ce2e.tar.gz
kiss-owns: only read the link for the directory, not the file itself
FossilOrigin-Name: adfa8d18eac96ea9c5d58b7b0778c25dcf0e3f146dddf5b6071bccc775e7eef0
Diffstat (limited to 'contrib/kiss-owns')
-rwxr-xr-xcontrib/kiss-owns6
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/kiss-owns b/contrib/kiss-owns
index e3512d6..c048c86 100755
--- a/contrib/kiss-owns
+++ b/contrib/kiss-owns
@@ -5,7 +5,9 @@ case "$1" in ''|--help|-h) printf '%s\n' "usage: kiss-owns <file>" ; exit 0 ; es
# Strip 'KISS_ROOT' from the file path if passed and
# follow symlinks.
-file=$(readlink -f "$KISS_ROOT/${1##$KISS_ROOT}")
+file="${1#$KISS_ROOT}"
+dirname=$(kiss-readlink "$KISS_ROOT/{$file%/*}")
+file="$dirname/${file##*/}"
# Check if the file exists and exit if it is not.
[ -f "$file" ] || {
@@ -17,7 +19,7 @@ file=$(readlink -f "$KISS_ROOT/${1##$KISS_ROOT}")
# Print the full path to the manifest file which contains
# the match to our search.
-pkg_owns=$(grep -lFx "${file##$KISS_ROOT}" \
+pkg_owns=$(grep -lFx "${file#$KISS_ROOT}" \
"$KISS_ROOT/var/db/kiss/installed/"*/manifest)