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
1 changed files with 12 additions and 10 deletions

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