cpt

Carbs Packaging Tools
git clone git://git.carbslinux.org/cpt
Log | Files | Refs | README | LICENSE

commit c08fa96314d8df3227192fce5bca65ef57d3982b
parent f073c4d4534af760b2b585ee665bf3c396a7b16b
Author: Cem Keylan <cem@ckyln.com>
Date:   Wed, 12 Aug 2020 12:33:23 +0300

cpt-owns: deal with relative path and commands, change output format

Diffstat:
Mcontrib/cpt-owns | 13++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/contrib/cpt-owns b/contrib/cpt-owns @@ -3,6 +3,17 @@ case "$1" in ''|--help|-h) printf '%s\n' "usage: ${0##*/} [file]" ; exit 0 ; esac +# If full path is not specified, use either the current directory, or look for +# a command. +case "$1" in /*) ;; + *) + if [ -f "$1" ]; then + set -- "$PWD/$1" + else + set -- "$(command -v "$1")" + fi +esac + # Strip 'CPT_ROOT' from the file path if passed and # follow symlinks. file="${1#$CPT_ROOT}" @@ -27,4 +38,4 @@ pkg_owns=$(grep -lFx "${file#$CPT_ROOT}" \ pkg_owns=${pkg_owns%/*} pkg_owns=${pkg_owns##*/} -printf '%s\n' "[$pkg_owns] owns '$1'" +printf '%s\n' "$pkg_owns"