How do folks feel about this possible alternative?
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 24c8474..4405097 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -69,6 +69,7 @@ from blivet.errors import NoDisksError
from blivet.errors import NotEnoughFreeSpaceError
from blivet.devicelibs import raid, crypto
from blivet.devices import LUKSDevice
+from blivet.platform import platform
from pyanaconda.storage_utils import ui_storage_logger, device_type_from_autopart
from pyanaconda.storage_utils import DEVICE_TEXT_PARTITION, DEVICE_TEXT_MAP,
DEVICE_TEXT_MD
@@ -1962,10 +1963,28 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
return
if dialog.deleteAll:
- for dev in (s._device for s in page.members):
- self._destroy_device(dev)
- else:
- self._destroy_device(device)
+ protected =
platform.bootStage1ConstraintDict["format_types"]
+ otherpgs = (pg for pg in self._accordion.allPages if
+ pg.pageTitle != page.pageTitle)
+ otherdevs = []
+ log.info("deleteall: otherdevs: %s", otherdevs)
+ for otherpg in otherpgs:
+ otherdevs.append(mem._device.id for mem in otherpg.members)
+ # we never want to delete known-shared devs here. we also
+ # exclude 'device' as we'll unconditionally delete it
later
+ for dev in (s._device for s in page.members if
+ s._device.id not in otherdevs and
+ s._device.id != device.id):
+ # we only want to delete boot partitions if they're not
+ # shared *and* we have no unknown partitions
+ if (not self.unusedDevices or dev.format.type not in protected):
+ log.info("deleteall: removed %s", dev.name)
+ self._destroy_device(dev)
+ else:
+ log.info("deleteall: didn't remove %s",
dev.name)
+
+ # We do this even in deleteAll case, see above comment
+ self._destroy_device(device)
log.info("ui: removed device %s", device.name)
Basically, when 'delete all' is clicked, don't delete any partitions that are
'shared' (appear in other roots), or bootloader partitions if there are any
unknown partitions (stole that idea from @jkonecny12 for the same reason - we don't
detect all OSes, so we use this as a proxy). I've tested it works in a simple UEFI
case, haven't tested the `otherdevs` (shared partitions) stuff yet. I can test this
and work on it some more if people are interested in the approach. If we do this we
*could* adjust the 'delete all' text to explain more clearly what will happen, and
maybe the delete confirm dialog text for bootloader partitions, but of course those are
string freeze breaks.
--
To view this pull request on github, visit
https://github.com/rhinstaller/anaconda/pull/377