test-avrdude: Condense two info lines into one

Condense the information about the avrdude binary executable
and its version from two output lines into a single output line.

Slight adaptation of code by Stefan Rueger from
https://github.com/avrdudes/avrdude/pull/1891#issuecomment-2293314322
This commit is contained in:
Hans Ulrich Niedermann
2024-08-16 15:50:58 +02:00
parent b8718e6b5d
commit cef23e252e

View File

@@ -149,13 +149,9 @@ fi
arraylength=${#pgm_and_target[@]}
echo -n "Testing executable type for '$avrdude_bin'..."
if type "$avrdude_bin" >/dev/null 2>&1; then
echo -n " "
type "$avrdude_bin"
else
echo
if ! type "$avrdude_bin" >/dev/null 2>&1; then
echo "$progname: cannot execute $avrdude_bin"
type "$avrdude_bin"
exit 1
fi
@@ -167,13 +163,12 @@ tmpfile=$(mktemp "$tmp/$progname.tmp.XXXXXX")
resfile=$(mktemp "$tmp/$progname.res.XXXXXX")
trap "rm -f $status $logfile $outfile $tmpfile $resfile" EXIT
echo -n "Testing $avrdude_bin version..."
$avrdude_bin -v 2>&1 | grep '[vV]ersion' | sed 's/^.* [Vv]ersion //' | head -n1 > "$outfile"
echo -n "Testing $(type -p "$avrdude_bin")"
$avrdude_bin -v 2>&1 | grep '[vV]ersion' | sed 's/^.* [Vv]ersion//' | head -n1 > "$outfile"
if test -s "$outfile"; then
echo -n " "
cat "$outfile"
else
echo " error"
echo ": error obtaining version from '$avrdude_bin -v'"
$avrdude_bin -v
exit 1
fi