board_status.sh: Double quote variables to prevent globbing and word splitting.
Quoting variables prevents word splitting and glob expansion, and prevents the script from breaking when input contains spaces, line feeds, glob characters and such. See shellcheck warning SC2086. Change-Id: I7256d2fc2a22bce7723950a534fef6d57cbd097f Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/12761 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
072b5aa5c5
commit
9f25da1f49
|
@ -70,7 +70,7 @@ _cmd()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" -eq "$REMOTE" ] && [ -n "$REMOTE_HOST" ]; then
|
if [ "$1" -eq "$REMOTE" ] && [ -n "$REMOTE_HOST" ]; then
|
||||||
ssh root@${REMOTE_HOST} "$2" > "$pipe_location" 2>&1
|
ssh "root@${REMOTE_HOST}" "$2" > "$pipe_location" 2>&1
|
||||||
else
|
else
|
||||||
$2 > "$pipe_location" 2>&1
|
$2 > "$pipe_location" 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -227,12 +227,12 @@ fi
|
||||||
test_cmd $LOCAL "$cbfstool_cmd"
|
test_cmd $LOCAL "$cbfstool_cmd"
|
||||||
echo "Extracting config.txt from build/coreboot.rom"
|
echo "Extracting config.txt from build/coreboot.rom"
|
||||||
$cbfstool_cmd build/coreboot.rom extract -n config -f "${tmpdir}/config.txt" >/dev/null 2>&1
|
$cbfstool_cmd build/coreboot.rom extract -n config -f "${tmpdir}/config.txt" >/dev/null 2>&1
|
||||||
mv ${tmpdir}/config.txt ${tmpdir}/config.short.txt
|
mv "${tmpdir}/config.txt" "${tmpdir}/config.short.txt"
|
||||||
cp ${tmpdir}/config.short.txt ${tmpcfg}
|
cp "${tmpdir}/config.short.txt" "${tmpcfg}"
|
||||||
yes "" | make DOTCONFIG=${tmpcfg} oldconfig 2>/dev/null >/dev/null
|
yes "" | make "DOTCONFIG=${tmpcfg}" oldconfig 2>/dev/null >/dev/null
|
||||||
mv ${tmpcfg} ${tmpdir}/config.txt
|
mv "${tmpcfg}" "${tmpdir}/config.txt"
|
||||||
rm -f ${tmpcfg}.old
|
rm -f "${tmpcfg}.old"
|
||||||
$cbfstool_cmd build/coreboot.rom print > ${tmpdir}/cbfs.txt
|
$cbfstool_cmd build/coreboot.rom print > "${tmpdir}/cbfs.txt"
|
||||||
rom_contents=$($cbfstool_cmd build/coreboot.rom print 2>&1)
|
rom_contents=$($cbfstool_cmd build/coreboot.rom print 2>&1)
|
||||||
if [ -n "$(echo $rom_contents | grep payload_config)" ]; then
|
if [ -n "$(echo $rom_contents | grep payload_config)" ]; then
|
||||||
echo "Extracting payload_config from build/coreboot.rom"
|
echo "Extracting payload_config from build/coreboot.rom"
|
||||||
|
@ -246,7 +246,7 @@ md5sum -b build/coreboot.rom > "${tmpdir}/rom_checksum.txt"
|
||||||
|
|
||||||
# Obtain board and revision info to form the directory structure:
|
# Obtain board and revision info to form the directory structure:
|
||||||
# <vendor>/<board>/<revision>/<timestamp>
|
# <vendor>/<board>/<revision>/<timestamp>
|
||||||
mainboard_dir="$(grep CONFIG_MAINBOARD_DIR ${tmpdir}/config.txt | awk -F '"' '{ print $2 }')"
|
mainboard_dir="$(grep CONFIG_MAINBOARD_DIR "${tmpdir}/config.txt" | awk -F '"' '{ print $2 }')"
|
||||||
vendor=$(echo "$mainboard_dir" | awk -F '/' '{ print $1 }')
|
vendor=$(echo "$mainboard_dir" | awk -F '/' '{ print $1 }')
|
||||||
mainboard=$(echo "$mainboard_dir" | awk -F '/' '{ print $2 }')
|
mainboard=$(echo "$mainboard_dir" | awk -F '/' '{ print $2 }')
|
||||||
|
|
||||||
|
@ -267,12 +267,12 @@ mv "${tmpdir}/config.short.txt" "${tmpdir}/${results}"
|
||||||
mv "${tmpdir}/cbfs.txt" "${tmpdir}/${results}"
|
mv "${tmpdir}/cbfs.txt" "${tmpdir}/${results}"
|
||||||
mv "${tmpdir}/rom_checksum.txt" "${tmpdir}/${results}"
|
mv "${tmpdir}/rom_checksum.txt" "${tmpdir}/${results}"
|
||||||
|
|
||||||
touch ${tmpdir}/${results}/revision.txt
|
touch "${tmpdir}/${results}/revision.txt"
|
||||||
printf "Local revision: %s\n" "$($getrevision -l)" >> ${tmpdir}/${results}/revision.txt
|
printf "Local revision: %s\n" "$($getrevision -l)" >> "${tmpdir}/${results}/revision.txt"
|
||||||
printf "Tagged revision: %s\n" "${tagged_version}" >> ${tmpdir}/${results}/revision.txt
|
printf "Tagged revision: %s\n" "${tagged_version}" >> "${tmpdir}/${results}/revision.txt"
|
||||||
printf "Upstream revision: %s\n" $($getrevision -u) >> ${tmpdir}/${results}/revision.txt
|
printf "Upstream revision: %s\n" "$($getrevision -u)" >> "${tmpdir}/${results}/revision.txt"
|
||||||
printf "Upstream URL: %s\n" $($getrevision -U)>> ${tmpdir}/${results}/revision.txt
|
printf "Upstream URL: %s\n" "$($getrevision -U)" >> "${tmpdir}/${results}/revision.txt"
|
||||||
printf "Timestamp: %s\n" "$timestamp" >> ${tmpdir}/${results}/revision.txt
|
printf "Timestamp: %s\n" "$timestamp" >> "${tmpdir}/${results}/revision.txt"
|
||||||
|
|
||||||
if [ -z "$SERIAL_DEVICE" ]; then
|
if [ -z "$SERIAL_DEVICE" ]; then
|
||||||
echo "Verifying that CBMEM is available on remote device"
|
echo "Verifying that CBMEM is available on remote device"
|
||||||
|
@ -301,7 +301,7 @@ if [ $UPLOAD_RESULTS -eq 1 ]; then
|
||||||
# FIXME: the board-status directory might get big over time.
|
# FIXME: the board-status directory might get big over time.
|
||||||
# Is there a way we can push the results without fetching the
|
# Is there a way we can push the results without fetching the
|
||||||
# whole repo?
|
# whole repo?
|
||||||
git clone $bsrepo
|
git clone "$bsrepo"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Error cloning board-status repo, aborting."
|
echo "Error cloning board-status repo, aborting."
|
||||||
exit $EXIT_FAILURE
|
exit $EXIT_FAILURE
|
||||||
|
@ -334,7 +334,7 @@ fi
|
||||||
cd "$coreboot_dir"
|
cd "$coreboot_dir"
|
||||||
|
|
||||||
if [ $CLOBBER_OUTPUT -eq 1 ]; then
|
if [ $CLOBBER_OUTPUT -eq 1 ]; then
|
||||||
rm -rf ${tmpdir}
|
rm -rf "${tmpdir}"
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo "output files are in ${tmpdir}/${results}"
|
echo "output files are in ${tmpdir}/${results}"
|
||||||
|
|
Loading…
Reference in New Issue