From 37a4a76cee128b624bb0ffa3dccda9efe3ca9911 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 12 Jul 2023 11:44:52 +1200 Subject: [PATCH] do not record install media as directly formatted instead prefer to record the partition as such (as casper does) --- subiquity/models/filesystem.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/subiquity/models/filesystem.py b/subiquity/models/filesystem.py index a4afd727a..34239895a 100644 --- a/subiquity/models/filesystem.py +++ b/subiquity/models/filesystem.py @@ -1274,6 +1274,23 @@ def process_probe_data(self): o._is_in_use = True work.extend(reverse_dependencies(o)) + # This is a special hack for the install media. When written to a USB + # stick or similar, both the block device for the whole drive and for + # the partition will show up as having a filesystem. Casper should + # preferentially mount it as a partition though and if it looks like + # that has happened, we ignore the filesystem on the drive itself. + for disk in self._all(type='disk'): + if disk._fs is None: + continue + if not disk._partitions: + continue + p1 = disk._partitions[0] + if p1._fs is None: + continue + if disk._fs.fstype == p1._fs.fstype == 'iso9660': + if p1._is_in_use and not disk._is_in_use: + self.remove_filesystem(disk._fs) + for o in self._actions: if o.type == "partition" and o.flag == "swap": if o._fs is None: