|
|
|
@ -63,9 +63,9 @@ cleanup() {
|
|
|
|
|
if [ -n "${RESTORE_FUNC}" ]; then
|
|
|
|
|
error "***** WARNING: Resize failed, attempting to revert ******"
|
|
|
|
|
if ${RESTORE_FUNC} ; then
|
|
|
|
|
error "***** Appears to have gone OK ****"
|
|
|
|
|
error "***** Restore appears to have gone OK ****"
|
|
|
|
|
else
|
|
|
|
|
error "***** FAILED! ******"
|
|
|
|
|
error "***** Restore FAILED! ******"
|
|
|
|
|
if [ -n "${RESTORE_HUMAN}" -a -f "${RESTORE_HUMAN}" ]; then
|
|
|
|
|
error "**** original table looked like: ****"
|
|
|
|
|
cat "${RESTORE_HUMAN}" 1>&2
|
|
|
|
@ -164,9 +164,16 @@ sfdisk_worked_but_blkrrpart_failed() {
|
|
|
|
|
# exit code found was just 1, but dont insist on that
|
|
|
|
|
#[ $ret -eq 1 ] || return 1
|
|
|
|
|
# Successfully wrote the new partition table
|
|
|
|
|
grep -qi "Success.* wrote.* new.* partition" "$output" &&
|
|
|
|
|
if grep -qi "Success.* wrote.* new.* partition" "$output"; then
|
|
|
|
|
grep -qi "BLKRRPART: Device or resource busy" "$output"
|
|
|
|
|
return
|
|
|
|
|
# The partition table has been altered.
|
|
|
|
|
elif grep -qi "The.* part.* table.* has.* been.* altered" "$output"; then
|
|
|
|
|
# Re-reading the partition table failed
|
|
|
|
|
grep -qi "Re-reading.* partition.* table.* failed" "$output"
|
|
|
|
|
return
|
|
|
|
|
fi
|
|
|
|
|
return $ret
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get_sfdisk_version() {
|
|
|
|
@ -337,7 +344,10 @@ resize_sfdisk() {
|
|
|
|
|
[ $ret -eq 0 ] || RESTORE_FUNC="${restore_func}"
|
|
|
|
|
|
|
|
|
|
if [ $ret -eq 0 ]; then
|
|
|
|
|
:
|
|
|
|
|
debug 1 "resize of ${DISK} returned 0."
|
|
|
|
|
if [ $VERBOSITY -gt 2 ]; then
|
|
|
|
|
sed 's,^,| ,' "${change_out}" 1>&2
|
|
|
|
|
fi
|
|
|
|
|
elif $PT_UPDATE &&
|
|
|
|
|
sfdisk_worked_but_blkrrpart_failed "$ret" "${change_out}"; then
|
|
|
|
|
# if the command failed, but it looks like only because
|
|
|
|
@ -624,7 +634,7 @@ pt_update() {
|
|
|
|
|
fi
|
|
|
|
|
# partx only works on block devices (do not run on file)
|
|
|
|
|
[ -b "$dev" ] || return 0
|
|
|
|
|
partx --update "$part" "$dev"
|
|
|
|
|
partx --update --nr "$part" "$dev"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
has_cmd() {
|
|
|
|
|