#! /bin/sh /usr/share/dpatch/dpatch-run ## 31_hfs_bless_file.dpatch by Colin Watson ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. @DPATCH@ diff -urNad cdrtools-2.01+01a01~/libhfs_iso/hfs.c cdrtools-2.01+01a01/libhfs_iso/hfs.c --- cdrtools-2.01+01a01~/libhfs_iso/hfs.c 2004-06-17 20:21:19.000000000 +0100 +++ cdrtools-2.01+01a01/libhfs_iso/hfs.c 2006-03-22 18:59:17.000000000 +0000 @@ -2150,21 +2150,25 @@ /* * NAME: hfs->vsetbless() - * DESCRIPTION: set blessed folder + * DESCRIPTION: set blessed folder or file * * adapted from vsetattr() from v3.2.6 */ #ifdef PROTOTYPES void -hfs_vsetbless(hfsvol *vol, unsigned long cnid) +hfs_vsetbless(hfsvol *vol, unsigned long cnid, int isfolder) #else void -hfs_vsetbless(vol, cnid) +hfs_vsetbless(vol, cnid, isfolder) hfsvol *vol; unsigned long cnid; + int isfolder; #endif { - vol->mdb.drFndrInfo[0] = cnid; + if (isfolder) + vol->mdb.drFndrInfo[0] = cnid; + else + vol->mdb.drFndrInfo[1] = cnid; vol->flags |= HFS_UPDATE_MDB; } diff -urNad cdrtools-2.01+01a01~/libhfs_iso/hfs.h cdrtools-2.01+01a01/libhfs_iso/hfs.h --- cdrtools-2.01+01a01~/libhfs_iso/hfs.h 2001-11-01 18:20:38.000000000 +0000 +++ cdrtools-2.01+01a01/libhfs_iso/hfs.h 2006-03-22 18:59:39.000000000 +0000 @@ -186,5 +186,5 @@ #ifdef APPLE_HYB unsigned short hfs_get_drAllocPtr __PR((hfsfile *)); int hfs_set_drAllocPtr __PR((hfsfile *, unsigned short, int size)); -void hfs_vsetbless __PR((hfsvol *, unsigned long)); +void hfs_vsetbless __PR((hfsvol *, unsigned long, int)); #endif /* APPLE_HYB */ diff -urNad cdrtools-2.01+01a01~/mkisofs/mkisofs.8 cdrtools-2.01+01a01/mkisofs/mkisofs.8 --- cdrtools-2.01+01a01~/mkisofs/mkisofs.8 2006-03-22 18:59:16.000000000 +0000 +++ cdrtools-2.01+01a01/mkisofs/mkisofs.8 2006-03-22 18:59:17.000000000 +0000 @@ -1673,6 +1673,15 @@ called System Folder, then the whole path name is "./cddata/System Folder" (remember to use quotes if the name contains spaces). .TP +.BI \-hfs\-bless\-file " file +"Bless" the given file as a boot file for EFI-based Macintosh systems. This +is used in creating HFS bootable CDs. The name of the directory must be the +whole path name as +.B mkisofs +sees it. e.g. if the given pathspec is ./cddata and the required file is +called /efi/boot.efi, then the whole path name is "./cddata/efi/boot.efi" +(remember to use quotes if the name contains spaces). +.TP .BI \-hfs\-parms " PARAMETERS Override certain parameters used to create the HFS file system. Unlikely to be used in normal circumstances. See the libhfs_iso/hybrid.h source file for diff -urNad cdrtools-2.01+01a01~/mkisofs/mkisofs.c cdrtools-2.01+01a01/mkisofs/mkisofs.c --- cdrtools-2.01+01a01~/mkisofs/mkisofs.c 2006-03-22 18:59:16.000000000 +0000 +++ cdrtools-2.01+01a01/mkisofs/mkisofs.c 2006-03-22 18:59:17.000000000 +0000 @@ -211,6 +211,7 @@ char *hfs_ocharset = NULL; /* output HFS charset name */ int hfs_lock = 1; /* lock HFS volume (read-only) */ char *hfs_bless = NULL; /* name of folder to 'bless' (System Folder) */ +char *hfs_bless_file = NULL; /* name of boot file to 'bless' (for EFI) */ char *hfs_parms = NULL; /* low level HFS parameters */ #ifdef PREP_BOOT @@ -456,14 +457,15 @@ #define OPTION_HFS_UNLOCK 2039 #define OPTION_HFS_BLESS 2040 -#define OPTION_HFS_PARMS 2041 +#define OPTION_HFS_BLESS_FILE 2041 +#define OPTION_HFS_PARMS 2042 -#define OPTION_CHRP_BOOT 2042 +#define OPTION_CHRP_BOOT 2043 -#define OPTION_RELOC_ROOT 2043 -#define OPTION_RELOC_OLD_ROOT 2044 +#define OPTION_RELOC_ROOT 2044 +#define OPTION_RELOC_OLD_ROOT 2045 -#define OPTION_MAP_FILE 2045 +#define OPTION_MAP_FILE 2046 #endif /* APPLE_HYB */ @@ -796,6 +798,8 @@ '\0', NULL, "Leave HFS Volume unlocked", ONE_DASH}, {{"hfs-bless", required_argument, NULL, OPTION_HFS_BLESS}, '\0', "FOLDER_NAME", "Name of Folder to be blessed", ONE_DASH}, + {{"hfs-bless-file", required_argument, NULL, OPTION_HFS_BLESS_FILE}, + '\0', "FILE", "Name of boot file to be blessed", ONE_DASH}, {{"hfs-parms", required_argument, NULL, OPTION_HFS_PARMS}, '\0', "PARAMETERS", "Comma separated list of HFS parameters", ONE_DASH}, #ifdef PREP_BOOT @@ -2400,6 +2404,9 @@ case OPTION_HFS_BLESS: hfs_bless = optarg; break; + case OPTION_HFS_BLESS_FILE: + hfs_bless_file = optarg; + break; case OPTION_HFS_PARMS: hfs_parms = strdup(optarg); break; diff -urNad cdrtools-2.01+01a01~/mkisofs/mkisofs.h cdrtools-2.01+01a01/mkisofs/mkisofs.h --- cdrtools-2.01+01a01~/mkisofs/mkisofs.h 2006-03-22 18:59:16.000000000 +0000 +++ cdrtools-2.01+01a01/mkisofs/mkisofs.h 2006-03-22 18:59:17.000000000 +0000 @@ -396,6 +396,7 @@ extern int icon_pos; /* Keep Icon position */ extern int hfs_lock; /* lock HFS volume (read-only) */ extern char *hfs_bless; /* name of folder to 'bless' (System Folder) */ +extern char *hfs_bless_file;/* name of boot file to 'bless' (for EFI) */ extern char *hfs_parms; /* low level HFS parameters */ #define MAP_LAST 1 /* process magic then map file */ diff -urNad cdrtools-2.01+01a01~/mkisofs/volume.c cdrtools-2.01+01a01/mkisofs/volume.c --- cdrtools-2.01+01a01~/mkisofs/volume.c 2004-07-09 14:06:36.000000000 +0100 +++ cdrtools-2.01+01a01/mkisofs/volume.c 2006-03-22 18:59:17.000000000 +0000 @@ -501,6 +501,21 @@ s_entry->whole_name); return (-1); } + + /* see if we need to "bless" this file */ + if (hfs_bless_file && + strcmp(s_entry->whole_name, + hfs_bless_file) == 0) { + hfs_stat(vol, ent->name, ent); + hfs_vsetbless(vol, ent->cnid, 0); + if (verbose > 0) { + fprintf(stderr, "Blessing file %s (%s)\n", + ent->name, + s_entry->whole_name); + } + /* stop any further checks */ + hfs_bless_file = NULL; + } } /* set folder info and custom icon (if it exists) */ @@ -630,7 +645,7 @@ if (hfs_bless && strcmp(s_entry->whole_name, hfs_bless) == 0) { hfs_stat(vol, ent->name, ent); - hfs_vsetbless(vol, ent->cnid); + hfs_vsetbless(vol, ent->cnid, 1); if (verbose > 0) { fprintf(stderr, "Blessing %s (%s)\n", ent->name,