I have multiple partitions on the internal and on two external drives.
Four of the partitions are startup disks as displayed by the StartupDisk.prefPane, which unfortunately, is not scriptable.
I need to generate the list of startup disks, in this example: {“HD-1”, “HD-3”, “MB-1”, “MB-3”}
tell application "System Events"
get the name of every disk -- gets the list of all mounted disks.
--> {"HD-1", "HD-2", "HD-3", "HD-4", "MB-1", "MB-2", "MB-3", "MB-4", "MB-5"}
get the name of every disk whose startup is true -- gets the actual startup disk but, NOT THE OTHER THREE.
--> {"HD-1"}
end tell
In the next scriptlet, I simply test for the “System” folder but, I’m sure, there is a bright spark out there to name a root folder “System” on a non-startup disk. Hard coding is not an option since the disk existence and names will differ.
tell application "Finder"
tell application "System Events" to set DiskList to get the name of every disk
--> {"HD-1", "HD-2", "HD-3", "HD-4", "MB-1", "MB-2", "MB-3", "MB-4", "MB-5"}
set StartupDiskList to {}
repeat with disk_i in DiskList
if exists (alias disk_i as text) & "System:" then copy disk_i to end of StartupDiskList
end repeat
--> {"HD-1", "HD-3", "MB-1", "MB-3"}
choose from list StartupDiskList with prompt "Choose a startup disk:"
set chooseResult to result as text
--> {"HD-3"} -- or whatever the choice is.
end tell
Is there a fail-safe property of any startup (bootable) disk, which I can test for? I can’t seem to find one in the relevant libraries.
Please prove me wrong or, some clever workaround.