From 6f670ca27d427542aa869636a57d2e393544a05f Mon Sep 17 00:00:00 2001 From: Aleksander Mistewicz Date: Wed, 15 Jun 2016 11:24:50 +0200 Subject: [PATCH] Add error handling to change_uuid() Change-Id: I51f06e0a797018e230861421b5aa16d8740a3f21 Signed-off-by: Aleksander Mistewicz --- tct/flash/flash.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tct/flash/flash.sh b/tct/flash/flash.sh index 65db62d..f2aede6 100755 --- a/tct/flash/flash.sh +++ b/tct/flash/flash.sh @@ -69,13 +69,17 @@ change_uuid() { # * 1st partition is vfat (boot) # * 3rd partition sometimes does not exists (i.e. wayland-efi) PART="${DEV_SDCARD}2" + test -b "${PART}" || die "Missing device: required partition is no longer present!" # remove uninit_bg option from filesystem for UUID change. result is: # * e2fsck is not required # * UUID change is successful - sudo tune2fs -O "^uninit_bg" "${PART}" - sudo tune2fs "${PART}" -U "${NEW_UUID}" - sudo tune2fs -O "+uninit_bg" "${PART}" + sudo tune2fs -O "^uninit_bg" "${PART}" || + die "Error returned by tune2fs: fs feature clear failed!" "$?" + sudo tune2fs "${PART}" -U "${NEW_UUID}" || + die "Error returned by tune2fs: uuid change failed!" "$?" + sudo tune2fs -O "+uninit_bg" "${PART}" || + echo "Error returned by tune2fs ($?): fs feature add failed!" echo "${NEW_UUID}" > "${FILE}" } -- 2.7.4