[OE-core] [PATCH] mkefidisk.sh: Add signal handling

Darren Hart dvhart at linux.intel.com
Mon Jul 21 23:46:50 UTC 2014


Add basic signal handling to unmount and remove any temporary files.
Correct a quoting issue with the die() function caught testing signal
handling.
Fix a minor typo in "formatting" output.

Signed-off-by: Darren Hart <dvhart at linux.intel.com>
---
 scripts/contrib/mkefidisk.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh
index 28cfb6d..b96b7d4 100755
--- a/scripts/contrib/mkefidisk.sh
+++ b/scripts/contrib/mkefidisk.sh
@@ -48,6 +48,8 @@ cleanup() {
 	fi
 }
 
+trap 'die "Signal Received, Aborting..."' HUP INT TERM
+
 # Logging routines
 WARNINGS=0
 ERRORS=0
@@ -71,7 +73,7 @@ success() {
 	echo "${GREEN}$1${CLEAR}"
 }
 die() {
-	error $1
+	error "$1"
 	cleanup
 	exit 1
 }
@@ -288,7 +290,7 @@ unmount_device || die "Failed to unmount $DEVICE partitions"
 #
 # Format $DEVICE partitions
 #
-info "Formating partitions"
+info "Formatting partitions"
 debug "Formatting $BOOTFS as vfat"
 if [ ! "${DEVICE#/dev/loop}" = "${DEVICE}" ]; then
 	mkfs.vfat -I $BOOTFS -n "EFI" >$OUT 2>&1 || die "Failed to format $BOOTFS"
-- 
2.0.0




More information about the Openembedded-core mailing list