3 # Script to create a bootable CD image file containing rEFInd.
6 # ./mkcdimage {version}
8 # where {version} is the rEFInd version number.
10 # This script relies on the mcopy utility.
12 # The script creates an image file from the binary package
13 # stored in ../snapshots/{version}/refind-bin-{version}.zip
14 # The resulting CD image file is stored in
15 # ../snapshots/{version}/refind-cd-{version}.iso
20 # Unzip the binary archive file....
21 cd ..
/snapshots
/$Version
25 unzip ..
/refind-bin-
$Version.
zip
26 cp $StartDir/SHELLS.txt .
/refind-bin-
$Version
28 # Create a boot directory and (temporarily) copy the EFI shell
30 mkdir
-p refind-bin-
$Version/EFI
/boot
31 cd refind-bin-
$Version/EFI
/boot
32 cp $StartDir/shell
*.efi .
/
34 # Create hard links to the rEFInd files so that they'll be suitable for an
36 ln ..
/..
/refind
/refind_ia32.efi .
/bootia32.efi
37 ln ..
/..
/refind
/refind_x64.efi .
/bootx64.efi
38 ln ..
/..
/refind
/refind_aa64.efi .
/bootaa64.efi
39 cp ..
/..
/refind
/refind.conf-sample .
/refind.conf
40 sed -i '/#showtools/a showtools shell,memtest,gdisk,apple_recovery,csr_rotate,windows_recovery,mok_tool,about,shutdown,reboot,firmware' refind.conf
41 sed -i '/#csr_values/a csr_values 10,77' refind.conf
44 ln ..
/..
/..
/refind
/icons
/* .
/
48 ln ..
/..
/..
/refind
/drivers_x64
/* .
/
52 ln ..
/..
/..
/refind
/drivers_ia32
/* .
/
56 ln ..
/..
/..
/refind
/drivers_aa64
/* .
/
59 # Get the size of the binaries to go in the El Torito image in kB
60 ToritoSize
=`du -s EFI | cut -f 1`
61 let ToritoSize
=($ToritoSize)/28
62 let ToritoSize
=($ToritoSize)*32
64 # Move the EFI shell files back to the root where they belong
65 # (They were in EFI/boot just so they'd get counted in ToritoSize)
66 mv EFI
/boot
/shell
*.efi .
/
68 # Prepare a FAT filesystem image and populate it with the
70 dd if=/dev
/zero of
=refind-bin-
$Version.img bs
=1024 count
=$ToritoSize
71 mkdosfs
-n "ElTorito" refind-bin-
$Version.img
72 mcopy
-irefind-bin-$Version.img
-s EFI shell
*.efi
::/
74 # Make the ISO-9660 image file....
75 mkisofs
-A "Bootable rEFInd" -V "rEFInd_$Version" -volset "rEFInd_$Version" \
76 -J -r -v -x .
/lost
+found
-o ..
/..
/refind-cd-
$Version.iso \
77 -eltorito-alt-boot -efi-boot refind-bin-
$Version.img \
80 # Create a bootable USB flash drive image, using the FAT filesystem
81 # created above and a stored partition table image (plus some empty
84 rm -f ..
/..
/refind-flashdrive-
$Version.
*
85 let FatSize
=`du -s refind-bin-$Version.img | cut -f 1`
86 let FatSize
=($FatSize)+2048
87 dd if=/dev
/zero of
=..
/..
/refind-flashdrive-
$Version.img bs
=1024 count
=$FatSize
88 sgdisk
-n 1:2048:0 -t 1:EF00
-g ..
/..
/refind-flashdrive-
$Version.img
89 if [[ $?
!= 0 ]] ; then
90 echo "sgdisk failed! Exiting!"
93 dd if=refind-bin-
$Version.img of
=..
/..
/refind-flashdrive-
$Version.img bs
=512 seek
=2048 conv
=notrunc
96 mkdir refind-flashdrive-
$Version
97 ln ..
/refind-flashdrive-
$Version.img refind-flashdrive-
$Version
98 cp $StartDir/README-flashdrive.txt
$StartDir/COPYING.txt
$StartDir/NEWS.txt \
99 $StartDir/CREDITS.txt
$StartDir/LICENSE.txt
$StartDir/SHELLS.txt refind-flashdrive-
$Version
100 zip -9r ..
/refind-flashdrive-
$Version.
zip refind-flashdrive-
$Version
104 # Zip up the optical disc image....
105 rm -f refind-cd-
$Version.
zip
106 zip -9 refind-cd-
$Version.
zip refind-cd-
$Version.iso