Descriptive comments for each h/fdisk command (#1106)

This commit is contained in:
Daniel Markstedt 2023-02-24 12:58:51 -08:00 committed by GitHub
parent cfc3390b81
commit 983cff735b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -317,56 +317,39 @@ class FileCmds:
server_info = self.piscsi.get_server_info() server_info = self.piscsi.get_server_info()
full_file_path = Path(server_info["image_dir"]) / file_name full_file_path = Path(server_info["image_dir"]) / file_name
# Inject hfdisk commands to create Drive with correct partitions # Inject hfdisk commands to create Mac partition table with HFS partitions
# https://www.codesrc.com/mediawiki/index.php/HFSFromScratch
# i initialize partition map
# continue with default first block
# C Create 1st partition with type specified next)
# continue with default
# 32 32 blocks (required for HFS+)
# Driver_Partition Partition Name
# Apple_Driver Partition Type (available types: Apple_Driver,
# Apple_Driver43, Apple_Free, Apple_HFS...)
# C Create 2nd partition with type specified next
# continue with default first block
# continue with default block size (rest of the disk)
# ${volumeName} Partition name provided by user
# Apple_HFS Partition Type
# w Write partition map to disk
# y Confirm partition table
# p Print partition map
if disk_format == "HFS": if disk_format == "HFS":
partitioning_tool = "hfdisk" partitioning_tool = "hfdisk"
commands = [ commands = [
"i", "i", # Initialize partition map
"", "", # Continue with default first block
"C", "C", # Create 1st partition with type specified next)
"", "", # Continue with default
"32", "32", # 32 block (required for HFS+)
"Driver_Partition", "Driver_Partition", # Partition Name
"Apple_Driver", "Apple_Driver", # Partition Type
"C", "C", # Create 2nd partition with type specified next
"", "", # Continue with default first block
"", "", # Continue with default block size (rest of the disk)
volume_name, volume_name, # Partition name
"Apple_HFS", "Apple_HFS", # Partition Type
"w", "w", # Write partition map to disk
"y", "y", # Confirm partition table
"p", "p", # Print partition map (for the log)
] ]
# Create a DOS label, primary partition, W95 FAT type # Inject fdisk commands to create primary FAT partition with MS-DOS label
elif disk_format == "FAT": elif disk_format == "FAT":
partitioning_tool = "fdisk" partitioning_tool = "fdisk"
commands = [ commands = [
"o", "o", # create a new empty DOS partition table
"n", "n", # add a new partition
"p", "p", # primary partition
"", "", # default partition number
"", "", # default first sector
"", "", # default last sector
"t", "t", # change partition type
"b", "b", # choose W95 FAT32 type
"w", "w", # write table to disk and exit
] ]
try: try:
process = Popen( process = Popen(