From 0c4c27b582dbd9b3a994758f3c09fb1338fd9803 Mon Sep 17 00:00:00 2001 From: Sven Joachim Date: Tue, 18 Apr 2017 18:21:52 +0200 Subject: Avoid the 'type' shell command It is not mandatory in POSIX and tus not implemented by posh. Use the in_path function instead which is taylored for this need. --- functions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions b/functions index e22d4a0..982174d 100644 --- a/functions +++ b/functions @@ -899,7 +899,7 @@ extract_ar_deb_field () { *) error 1 UNKNOWNCONTROLCOMP "Unknown compression type for %s in %s" "$tarball" "$pkg" ;; esac - if type $cat_cmd >/dev/null 2>&1; then + if in_path $cat_cmd >/dev/null 2>&1; then ar -p "$pkg" "$tarball" | $cat_cmd | tar -O -xf - control ./control 2>/dev/null | grep -i "^$field:" | sed -e 's/[^:]*: *//' | head -n 1 @@ -920,7 +920,7 @@ extract_ar_deb_data () { *) error 1 UNKNOWNDATACOMP "Unknown compression type for %s in %s" "$tarball" "$pkg" ;; esac - if type $cat_cmd >/dev/null 2>&1; then + if in_path $cat_cmd >/dev/null 2>&1; then ar -p "$pkg" "$tarball" | $cat_cmd | tar $EXTRACT_DEB_TAR_OPTIONS -xf - else error 1 UNPACKCMDUNVL "Extracting %s requires the %s command, which is not available" "$pkg" "$cat_cmd" @@ -944,7 +944,7 @@ choose_extractor () { if [ -n "$EXTRACTOR_OVERRIDE" ]; then extractor="$EXTRACTOR_OVERRIDE" - elif type dpkg-deb >/dev/null 2>&1; then + elif in_path dpkg-deb >/dev/null 2>&1; then extractor="dpkg-deb" else extractor="ar" -- cgit v0.12