portsnap: Detect error immediately if we can't fetch the snapshot metadata.

Also add some quotes around command substitution where useful and possible.

Reviewed by:	cperciva
MFC after:	1 week
This commit is contained in:
Jilles Tjoelker 2011-10-04 22:28:06 +00:00
parent df8d253fb4
commit b77e3cbad1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226028

View File

@ -536,9 +536,9 @@ fetch_metadata() {
rm -f ${SNAPSHOTHASH} tINDEX.new
echo ${NDEBUG} "Fetching snapshot metadata... "
fetch ${QUIETFLAG} http://${SERVERNAME}/t/${SNAPSHOTHASH}
fetch ${QUIETFLAG} http://${SERVERNAME}/t/${SNAPSHOTHASH} \
2>${QUIETREDIR} || return
if [ `${SHA256} -q ${SNAPSHOTHASH}` != ${SNAPSHOTHASH} ]; then
if [ "`${SHA256} -q ${SNAPSHOTHASH}`" != ${SNAPSHOTHASH} ]; then
echo "snapshot metadata corrupt."
return 1
fi
@ -606,7 +606,7 @@ fetch_index_sanity() {
# Verify a list of files
fetch_snapshot_verify() {
while read F; do
if [ `gunzip -c snap/${F} | ${SHA256} -q` != ${F} ]; then
if [ "`gunzip -c snap/${F} | ${SHA256} -q`" != ${F} ]; then
echo "snapshot corrupt."
return 1
fi