Skip to content

Commit

Permalink
Exit immediately on non-zero status from pipelines
Browse files Browse the repository at this point in the history
Prior to this change, the script allowed for silent failures of pipelines.
This change uses the set -e command to alter that default behavior.

This change also ignores a non-zero status when unmount is called to unmount
the USB device's first partition.  Testing showed that the umount command
returned a non-zero status on every execution because the partition was not
mounted.  Prior to this change, the same non-zero status was being ignored.

Related: calmh#14
  • Loading branch information
troyjfarrell committed Feb 7, 2017
1 parent 219dda5 commit 84999ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion platform-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# https://github.com/calmh/smartos-platform-upgrade
# Copyright (c) 2012-2016 Jakob Borg & Contributors
# Distributed under the MIT License
set -e

# us-east.manta.joyent.com currently uses a wildcard certificate based on the
# Thawte Primary Root CA.
Expand Down Expand Up @@ -127,7 +128,8 @@ else
echo -n " using $usb"
fi

umount "$usb" 2>/dev/null
# This command may fail if the USB partition is not mounted.
umount "$usb" 2>/dev/null || true
mkdir usb
if ! mount -F pcfs -o foldcase "$usb" "$tmp/usb" ; then
echo ", mount failed"
Expand Down

0 comments on commit 84999ca

Please sign in to comment.