Skip to content

Commit

Permalink
detect the actual tar version present on the system
Browse files Browse the repository at this point in the history
The current script does not work on my machine because it assumes that any
machine running Darwin will also have bsdtar.  I am running Darwin, but have
also installed the superior GNU tar, so the assumption does not hold.

Instead, I made it read the `--version` output to see if we identify either GNU
or BSD version of tar.
  • Loading branch information
Ptival committed Jan 27, 2022
1 parent f4f7af7 commit e03320c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/unpack_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ unlzma_mv_untar () {
if [[ "$TAR_FILE.lzma" -nt "$TAR_FILE" ]] ; then
unlzma -k "$TAR_FILE.lzma"
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
TARVER=`tar --version | head -n 1`
if [[ "$TARVER" =~ "tar (GNU tar)" ]]; then
tar --overwrite -xf $TAR_FILE
elif [[ "$TARVER" =~ "bsdtar" ]]; then
tar -xkf $TAR_FILE
else
tar --overwrite -xf $TAR_FILE
echo "Unknown version of tar, please report!"
exit 1
fi
echo " done!"
popd # $DIR
Expand All @@ -34,4 +38,4 @@ unlzma_mv_untar "lib64.tar" "centos7-dev/lib64"
unlzma_mv_untar "debug-lib64.tar" "centos7-dev/debug-lib64"


popd > /dev/null # $BENCHMARK_DIR
popd > /dev/null # $BENCHMARK_DIR

0 comments on commit e03320c

Please sign in to comment.