Improved handling of dd failure

This commit is contained in:
Thomas Schmitt 2019-12-12 23:26:04 +01:00
parent f6c56febbf
commit a3a351bb59
2 changed files with 16 additions and 2 deletions

View File

@ -670,7 +670,14 @@ write_image() {
else else
echo "Performing:" echo "Performing:"
echo " $sudo_cmd $dd_cmd if='${1}' bs=1M of=/dev/'${2}' ; sync" echo " $sudo_cmd $dd_cmd if='${1}' bs=1M of=/dev/'${2}' ; sync"
$sudo_cmd "$dd_cmd" if="${1}" bs=1M of=/dev/"${2}" ; sync $sudo_cmd "$dd_cmd" if="${1}" bs=1M of=/dev/"${2}"
ret="$?"
sync
if test "$ret" -ne 0
then
echo "FAILURE: $sudo_cmd $dd_cmd was not successful" >&2
return 18
fi
fi fi
# >>> ??? Erase possible GPT backup table at end of device ? # >>> ??? Erase possible GPT backup table at end of device ?

View File

@ -706,7 +706,14 @@ xdt_write_image() {
else else
echo "Performing:" echo "Performing:"
echo " $xdt_sudo_cmd $xdt_dd_cmd if='${1}' bs=1M of=/dev/'${2}' ; sync" echo " $xdt_sudo_cmd $xdt_dd_cmd if='${1}' bs=1M of=/dev/'${2}' ; sync"
$xdt_sudo_cmd "$xdt_dd_cmd" if="${1}" bs=1M of=/dev/"${2}" ; sync $xdt_sudo_cmd "$xdt_dd_cmd" if="${1}" bs=1M of=/dev/"${2}"
xdt_ret="$?"
sync
if test "$xdt_ret" -ne 0
then
echo "FAILURE: $xdt_sudo_cmd $xdt_dd_cmd was not successful" >&2
return 18
fi
fi fi
# >>> ??? Erase possible GPT backup table at end of device ? # >>> ??? Erase possible GPT backup table at end of device ?