kiss: rewrite install input

This commit is contained in:
Dylan Araps 2021-07-06 22:07:12 +03:00
parent 0c51261486
commit 5f93bfef55
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C

22
kiss
View File

@ -1262,18 +1262,20 @@ pkg_install() {
# Install can also take the full path to a tarball. We don't need to check
# the repository if this is the case.
if [ -f "$1" ] && [ -z "${1%%*.tar.*}" ]; then
tar_file=$1 pkg_name=${1##*/} pkg_name=${pkg_name%[#@]*}
elif pkg_cache "$1" 2>/dev/null; then
pkg_name=$1
else
case $1 in
*.tar.*) die "Tarball '$1' does not exist" ;;
*) die "Package '$1' has not yet been built"
*.tar.*)
[ -f "$1" ] || die "File '$1' does not exist"
tar_file=$1
pkg_name=${1##*/}
pkg_name=${pkg_name%@*}
;;
*)
pkg_cache "$1" || die "$1" "Not yet built"
pkg_name=$1
;;
esac
fi
mkdir -p "$tar_dir/$pkg_name"
cd "$tar_dir/$pkg_name"