forked from kiss-community/kiss
kiss: Use libarchive tar if available.
This commit is contained in:
parent
a59f1dad60
commit
e7b88e7687
14
kiss
14
kiss
@ -228,7 +228,7 @@ pkg_extract() {
|
||||
# Any other file-types are simply copied to '$mak_dir' which
|
||||
# allows for manual extraction.
|
||||
*://*.tar|*://*.tar.??|*://*.tar.???|*://*.tar.????|*://*.tgz)
|
||||
tar xf "$src_dir/$1/${src##*/}" --strip-components 1 ||
|
||||
"$tar" xf "$src_dir/$1/${src##*/}" --strip-components 1 ||
|
||||
die "$1" "Couldn't extract ${src##*/}"
|
||||
;;
|
||||
|
||||
@ -430,7 +430,7 @@ pkg_tar() {
|
||||
read -r version release < "$(pkg_find "$1")/version"
|
||||
|
||||
# Create a tar-ball from the contents of the built package.
|
||||
tar zpcf "$bin_dir/$1#$version-$release.tar.gz" -C "$pkg_dir/$1" . ||
|
||||
"$tar" zpcf "$bin_dir/$1#$version-$release.tar.gz" -C "$pkg_dir/$1" . ||
|
||||
die "$1" "Failed to create tar-ball"
|
||||
|
||||
log "$1" "Successfully created tar-ball"
|
||||
@ -654,7 +654,7 @@ pkg_conflicts() {
|
||||
# Filter the tarball's manifest and select only files
|
||||
# and any files they resolve to on the filesystem
|
||||
# (/bin/ls -> /usr/bin/ls).
|
||||
tar xf "$1" -O "./$pkg_db/$2/manifest" | while read -r file; do
|
||||
"$tar" xf "$1" -O "./$pkg_db/$2/manifest" | while read -r file; do
|
||||
case $file in */) continue; esac
|
||||
|
||||
printf '%s/%s\n' \
|
||||
@ -869,7 +869,7 @@ pkg_install() {
|
||||
# Figure out which package the tar-ball installs by checking for
|
||||
# a database entry inside the tar-ball. If no database entry exists,
|
||||
# exit here as the tar-ball is *most likely* not a KISS package.
|
||||
pkg_name=$(tar tf "$tar_file" | "$grep" -x "\./$pkg_db/.*/version") ||
|
||||
pkg_name=$("$tar" tf "$tar_file" | "$grep" -x "\./$pkg_db/.*/version") ||
|
||||
die "'${tar_file##*/}' is not a valid KISS package"
|
||||
|
||||
pkg_name=${pkg_name%/*}
|
||||
@ -878,7 +878,7 @@ pkg_install() {
|
||||
mkdir -p "$tar_dir/$pkg_name"
|
||||
|
||||
# Extract the tar-ball to catch any errors before installation begins.
|
||||
tar pxf "$tar_file" -C "$tar_dir/$pkg_name" ||
|
||||
"$tar" pxf "$tar_file" -C "$tar_dir/$pkg_name" ||
|
||||
die "$pkg_name" "Failed to extract tar-ball"
|
||||
|
||||
log "$pkg_name" "Checking that all dependencies are installed"
|
||||
@ -1295,6 +1295,10 @@ main() {
|
||||
# POSIX correctness.
|
||||
grep=$(command -v ggrep) || grep='grep'
|
||||
|
||||
# Prefer libarchive tar if installed as it is much much faster than
|
||||
# busybox's implementation. Very much worth it if you value performance.
|
||||
tar=$(command -v bsdtar) || tar='tar'
|
||||
|
||||
# Figure out which 'sudo' command to use based on the user's choice or
|
||||
# what is available on the system.
|
||||
su=${KISS_SU:-$(command -v sudo || command -v doas)} || su=su
|
||||
|
Loading…
Reference in New Issue
Block a user