From 3f1ade345ba92747c325f5cfa7c189b8b15fe433 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Thu, 1 Mar 2018 17:51:55 +0100 Subject: [PATCH] Umount all partitions before repartition --- addon/lib/rmupdate.tcl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addon/lib/rmupdate.tcl b/addon/lib/rmupdate.tcl index 82453dc..24e7dcb 100644 --- a/addon/lib/rmupdate.tcl +++ b/addon/lib/rmupdate.tcl @@ -743,8 +743,16 @@ proc ::rmupdate::move_userfs_to_device {target_device {sync_data 0} {repartition } if {$target_partition_device == ""} { + array set partitions [get_partitions $target_device] + set keys [array names partitions] set partition_number 0 if {$repartition == 1} { + foreach key $keys { + regexp {^(.+)::([^:]+)$} $key match id opt + if {$opt == "partition_device"} { + catch { exec /bin/umount $partitions($key) } + } + } set exitcode [catch { exec /usr/sbin/parted --script ${target_device} \ mklabel msdos \ @@ -755,8 +763,6 @@ proc ::rmupdate::move_userfs_to_device {target_device {sync_data 0} {repartition } set partition_number 1 } else { - array set partitions [get_partitions $target_device] - set keys [array names partitions] foreach key $keys { regexp {^(.+)::([^:]+)$} $key match id opt if {$opt == "filesystem_label"} {