Skip to content

Commit

Permalink
binaries download script: improve reliability 💚
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed May 22, 2023
1 parent c90e794 commit c096458
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion download-binaries/index.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/bin/bash
set -e
set -e -u -o pipefail
cd $(dirname $0)

set +e
tar_exec=$(command -v gtar)
if [ $? -ne 0 ]; then
tar_exec=$(command -v tar)
fi
if [ -z "$tar_exec" ]; then
1>&2 echo "no tar executable found"
exit 1
fi
# https://rtfmp.wordpress.com/2017/03/31/difference-7z-7za-and-7zr/
p7zip_exec=$(command -v 7zr)
if [ $? -ne 0 ]; then
Expand All @@ -15,6 +19,10 @@ fi
if [ $? -ne 0 ]; then
p7zip_exec=$(command -v 7z)
fi
if [ -z "$p7zip_exec" ]; then
1>&2 echo "no p7zip executable found"
exit 1
fi
set -e
echo using tar executable at $tar_exec
echo using 7z executable at $p7zip_exec
Expand Down

0 comments on commit c096458

Please sign in to comment.