MCPcopy
hub / github.com/corpnewt/gibMacOS / _get_physical_disk

Method _get_physical_disk

Scripts/disk.py:244–272  ·  view source on GitHub ↗
(self, disk, search_term)

Source from the content-addressed store, hash-verified

242 return disk_id.replace("disk", "didk").split("s")[0].replace("didk", "disk")
243
244 def _get_physical_disk(self, disk, search_term):
245 # Change disk0s1 to disk0
246 our_disk = self.get_top_identifier(disk)
247 our_term = "/dev/" + our_disk
248 found_disk = False
249 our_text = ""
250 for line in self.disk_text.split("\n"):
251 if line.lower().startswith(our_term):
252 found_disk = True
253 continue
254 if not found_disk:
255 continue
256 if line.lower().startswith("/dev/disk"):
257 # At the next disk - bail
258 break
259 if search_term.lower() in line.lower():
260 our_text = line
261 break
262 if not len(our_text):
263 # Nothing found
264 return None
265 our_stores = "".join(our_text.strip().split(search_term)[1:]).split(" ,")
266 if not len(our_stores):
267 return None
268 for store in our_stores:
269 efi = self.get_efi(store)
270 if efi:
271 return store
272 return None
273
274 def get_physical_store(self, disk):
275 # Returns the physical store containing the EFI

Callers 3

is_core_storageMethod · 0.95
get_physical_storeMethod · 0.95
get_core_storage_pvMethod · 0.95

Calls 2

get_top_identifierMethod · 0.95
get_efiMethod · 0.95

Tested by

no test coverage detected