mirror of
https://github.com/oasislinux/oasis.git
synced 2026-02-05 11:33:57 +01:00
19 lines
342 B
Bash
19 lines
342 B
Bash
file=$1
|
|
shift
|
|
|
|
case $file in
|
|
*.tar.gz|*.tgz) tool=gzip ;;
|
|
*.tar.bz2) tool=bzip2 ;;
|
|
*.tar.xz) tool=xz ;;
|
|
*) exit 0
|
|
esac
|
|
|
|
if command -v bsdtar >/dev/null; then
|
|
exec bsdtar -xf "$file" "$@"
|
|
elif command -v pax >/dev/null; then
|
|
"$tool" -d -c "$file" | pax -r "$@"
|
|
else
|
|
printf '%s: bsdtar or pax is required' "$0" >&2
|
|
exit 1
|
|
fi
|