[28449] in Source-Commits
scripts commit: Tweak error text; add sanity checks
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Fri Sep 26 10:26:06 2014
Date: Fri, 26 Sep 2014 10:25:59 -0400
From: Jonathan D Reed <jdreed@mit.edu>
Message-Id: <201409261425.s8QEPx9W016984@drugstore.mit.edu>
To: source-commits@mit.edu
https://github.com/mit-athena/scripts/commit/ae405878324ea4c22dce9e657fb69b516581397a
commit ae405878324ea4c22dce9e657fb69b516581397a
Author: Jonathan Reed <jdreed@mit.edu>
Date: Fri Sep 26 10:23:04 2014 -0400
Tweak error text; add sanity checks
- set +o pipefail before the dig command in case someone
did something dumb earlier
- add "--" before the $PID in the kill command in case the file
contains garbage
- tweak some output for better readability
tests/installer/install-test.sh | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/tests/installer/install-test.sh b/tests/installer/install-test.sh
index 7a7eb78..87706e2 100755
--- a/tests/installer/install-test.sh
+++ b/tests/installer/install-test.sh
@@ -34,10 +34,10 @@ stop_qemu() {
fi
if ! echo quit | nc localhost 4444; then
echo "Couldn't send quit command to monitor! Trying to kill.." >&2
- kill "$PID" || :
+ kill -- "$PID" || :
fi
sleep 1
- if kill -0 "$PID" 2>/dev/null; then
+ if kill -0 -- "$PID" 2>/dev/null; then
echo "Uh oh, QEMU is still running. You're on your own." >&2
fi
}
@@ -101,7 +101,7 @@ case "$ARCH" in
;;
esac
[ -n "$SUITE" ] || die "SUITE unspecified"
-[ -f "$ISOLINUXBIN" ] || die "$ISOLINUXBIN missing"
+[ -f "$ISOLINUXBIN" ] || die "isolinux.bin ($ISOLINUXBIN) missing"
if [ -n "$LOGFILE" ]; then
if ! [ -d "$(dirname "$LOGFILE")" ]; then
@@ -131,13 +131,14 @@ set -ex
TMPDIR=$(mktemp -d --tmpdir="$SCRATCH")
echo -n "Looking up $HOSTNAME ... "
-# This will always return true because of tail(1)
+# Ensure this doesn't fail
+set +o pipefail
IP=$(dig +short $HOSTNAME | tail -1)
if echo "$IP" | grep -q '[^0-9\.]'; then
echo "bad IP ($IP)."
exit 1
else
- echo "$IP"
+ echo "IP=$IP"
fi
# Ewww, replace this with netparams ASAP