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

2014-07-21 Thread Darren Hart
Add basic signal handling to unmount and remove any temporary files.

Signed-off-by: Darren Hart dvh...@linux.intel.com
---
 scripts/contrib/mkefidisk.sh | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh
index 44ab8d5..7d48b53 100755
--- a/scripts/contrib/mkefidisk.sh
+++ b/scripts/contrib/mkefidisk.sh
@@ -46,7 +46,9 @@ cleanup() {
if [ -d $TMPDIR ]; then
rm -rf $TMPDIR || error Failed to remove $TMPDIR
fi
+   exit $1
 }
+trap cleanup HUP INT TERM
 
 # Logging routines
 WARNINGS=0
@@ -72,8 +74,7 @@ success() {
 }
 die() {
error $1
-   cleanup
-   exit 1
+   cleanup 1
 }
 debug() {
if [ $DEBUG -eq 1 ]; then
@@ -375,10 +376,6 @@ if [ -d $ROOTFS_MNT/etc/udev/ ] ; then
echo $TARGET_DEVICE  $ROOTFS_MNT/etc/udev/mount.blacklist
 fi
 
-
-# Call cleanup to unmount devices and images and remove the TMPDIR
-cleanup
-
 echo 
 if [ $WARNINGS -ne 0 ]  [ $ERRORS -eq 0 ]; then
echo ${YELLOW}Installation completed with warnings${CLEAR}
@@ -391,3 +388,6 @@ else
success Installation completed successfully
 fi
 echo 
+
+# Call cleanup to unmount devices and images and remove the TMPDIR
+cleanup 0
-- 
2.0.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

2014-07-21 Thread Darren Hart
Please ignore this one (2/2), it rearranges output in a way that might
lead to someone pulling the USB key before the sync completes. I will
resend 2/2 of separately.

Apologies :/

On 7/21/14, 15:45, Darren Hart dvh...@linux.intel.com wrote:

Add basic signal handling to unmount and remove any temporary files.

Signed-off-by: Darren Hart dvh...@linux.intel.com
---
 scripts/contrib/mkefidisk.sh | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh
index 44ab8d5..7d48b53 100755
--- a/scripts/contrib/mkefidisk.sh
+++ b/scripts/contrib/mkefidisk.sh
@@ -46,7 +46,9 @@ cleanup() {
   if [ -d $TMPDIR ]; then
   rm -rf $TMPDIR || error Failed to remove $TMPDIR
   fi
+  exit $1
 }
+trap cleanup HUP INT TERM
 
 # Logging routines
 WARNINGS=0
@@ -72,8 +74,7 @@ success() {
 }
 die() {
   error $1
-  cleanup
-  exit 1
+  cleanup 1
 }
 debug() {
   if [ $DEBUG -eq 1 ]; then
@@ -375,10 +376,6 @@ if [ -d $ROOTFS_MNT/etc/udev/ ] ; then
   echo $TARGET_DEVICE  $ROOTFS_MNT/etc/udev/mount.blacklist
 fi
 
-
-# Call cleanup to unmount devices and images and remove the TMPDIR
-cleanup
-
 echo 
 if [ $WARNINGS -ne 0 ]  [ $ERRORS -eq 0 ]; then
   echo ${YELLOW}Installation completed with warnings${CLEAR}
@@ -391,3 +388,6 @@ else
   success Installation completed successfully
 fi
 echo 
+
+# Call cleanup to unmount devices and images and remove the TMPDIR
+cleanup 0
-- 
2.0.0




-- 
Darren Hart Open Source Technology Center
darren.h...@intel.com   Intel Corporation



-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core