Added ability to set the TYPE/CREATOR resource fork attributes of file(s) inside newly-created cd-rom ISO images of type HFS

This commit is contained in:
i-to-z 2023-11-17 16:35:38 -08:00
parent e5b99d4fa9
commit ed245b295a
2 changed files with 35 additions and 1 deletions

View File

@ -582,6 +582,23 @@ function fetchHardDiskDrivers() {
fi
}
# Fetch file genisoimage_hfs_resource_fork_map.txt file.
# It is used when creating ISO images of type HFS.
function fetchGenisoimageHfsResourceForkMapFile() {
GENISOIMAGE_MAP_FOLDER="genisoimage_hfs_resource_fork_map"
GENISOIMAGE_MAP_FILE="genisoimage_hfs_resource_fork_map.txt"
if [ ! -d "$BASE/$GENISOIMAGE_MAP_FOLDER" ]; then
mkdir -p "$BASE/$GENISOIMAGE_MAP_FOLDER"
# Do not overwrite the file if it already exists locally:
if [ ! -f "$BASE/$GENISOIMAGE_MAP_FOLDER/$GENISOIMAGE_MAP_FILE" ]; then
cd "$BASE/$GENISOIMAGE_MAP_FOLDER" || exit 1
# Currently the file is in Google Drive, but ideally it should be hosted on Dropbox,
# similar to the hard disk drivers above, see fetchHardDiskDrivers()
wget "https://drive.google.com/uc?export=download&id=1fUHyY8puxw3cWa9mH17G-f5--JiqplAR" -O "$GENISOIMAGE_MAP_FILE"
fi
fi
}
# Modifies system configurations for a wired network bridge
function setupWiredNetworking() {
echo "Setting up wired network..."
@ -1249,6 +1266,7 @@ function runChoice() {
installPackages
installHfdisk
fetchHardDiskDrivers
fetchGenisoimageHfsResourceForkMapFile
stopService "piscsi-ctrlboard"
stopService "piscsi-oled"
stopService "piscsi"
@ -1432,6 +1450,7 @@ function runChoice() {
installPackagesWeb
installHfdisk
fetchHardDiskDrivers
fetchGenisoimageHfsResourceForkMapFile
preparePythonCommon
cachePipPackages
installPiscsiWebInterface
@ -1484,6 +1503,7 @@ function runChoice() {
installPackages
installHfdisk
fetchHardDiskDrivers
fetchGenisoimageHfsResourceForkMapFile
compilePiscsi
installPiscsi
configurePiscsiService

View File

@ -940,7 +940,21 @@ def download_to_iso():
local_file = request.form.get("file")
if iso_type == "HFS":
iso_args = ["-hfs"]
# The file was downloaded into this location during installation, see fetchGenisoimageHfsResourceForkMapFile() in easyinstall.sh
genisoimage_hfs_resource_fork_map_file_path = Path(f"{WEB_DIR}/../../../genisoimage_hfs_resource_fork_map/genisoimage_hfs_resource_fork_map.txt")
if genisoimage_hfs_resource_fork_map_file_path.exists():
# genisoimage will look up the file extension in the map file to derive the file's CREATOR and TYPE
# resource fork attributes, see more at https://linux.die.net/man/1/genisoimage
iso_args = ["-hfs", "-map", str(genisoimage_hfs_resource_fork_map_file_path)]
logging.info(
"Found and using genisoimage hfs map file at %s .",
str(genisoimage_hfs_resource_fork_map_file_path))
else:
logging.warning(
"Genisoimage hfs map file %s is not present at %s. Will not set resource fork attributes of files in the iso image!",
str(genisoimage_hfs_resource_fork_map_file_path),
)
iso_args = ["-hfs"]
elif iso_type == "ISO-9660 Level 1":
iso_args = ["-iso-level", "1"]
elif iso_type == "ISO-9660 Level 2":