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
1 changed files with 26 additions and 43 deletions

View File

@ -317,56 +317,39 @@ class FileCmds:
server_info = self.piscsi.get_server_info()
full_file_path = Path(server_info["image_dir"]) / file_name
# Inject hfdisk commands to create Drive with correct 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
# Inject hfdisk commands to create Mac partition table with HFS partitions
if disk_format == "HFS":
partitioning_tool = "hfdisk"
commands = [
"i",
"",
"C",
"",
"32",
"Driver_Partition",
"Apple_Driver",
"C",
"",
"",
volume_name,
"Apple_HFS",
"w",
"y",
"p",
"i", # Initialize partition map
"", # Continue with default first block
"C", # Create 1st partition with type specified next)
"", # Continue with default
"32", # 32 block (required for HFS+)
"Driver_Partition", # Partition Name
"Apple_Driver", # Partition Type
"C", # Create 2nd partition with type specified next
"", # Continue with default first block
"", # Continue with default block size (rest of the disk)
volume_name, # Partition name
"Apple_HFS", # Partition Type
"w", # Write partition map to disk
"y", # Confirm partition table
"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":
partitioning_tool = "fdisk"
commands = [
"o",
"n",
"p",
"",
"",
"",
"t",
"b",
"w",
"o", # create a new empty DOS partition table
"n", # add a new partition
"p", # primary partition
"", # default partition number
"", # default first sector
"", # default last sector
"t", # change partition type
"b", # choose W95 FAT32 type
"w", # write table to disk and exit
]
try:
process = Popen(