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.conf-sample .
/refind.conf
41 ln ..
/..
/..
/refind
/icons
/* .
/
45 ln ..
/..
/..
/refind
/drivers_x64
/* .
/
49 ln ..
/..
/..
/refind
/drivers_x64
/* .
/
52 # Get the size of the binaries to go in the El Torito image in kB
53 ToritoSize
=`du -s EFI | cut -f 1`
54 let ToritoSize
=($ToritoSize)/28
55 let ToritoSize
=($ToritoSize)*32
57 # Move the EFI shell files back to the root where they belong
58 # (They were in EFI/boot just so they'd get counted in ToritoSize)
59 mv EFI
/boot
/shell
*.efi .
/
61 # Prepare a FAT filesystem image and populate it with the
63 dd if=/dev
/zero of
=refind-bin-
$Version.img bs
=1024 count
=$ToritoSize
64 mkdosfs
-n "ElTorito" refind-bin-
$Version.img
65 mcopy
-irefind-bin-$Version.img
-s EFI shell
*.efi
::/
67 # Make the ISO-9660 image file....
68 mkisofs
-A "Bootable rEFInd" -V "rEFInd_$Version" -volset "rEFInd_$Version" \
69 -J -r -v -x .
/lost
+found
-o ..
/..
/refind-cd-
$Version.iso \
70 -eltorito-alt-boot -efi-boot refind-bin-
$Version.img \
73 # Below is like above, but also creates an El Torito entry for BIOS
74 # booting. That's useless, but in case something flakes out without
75 # it, I'll preserve this version for a while....
76 #mkisofs -A "Bootable rEFInd" -V "rEFInd $Version" -volset "rEFInd $Version" \
77 # -J -r -v -x ./lost+found -o ../../refind-cd-$Version.iso \
78 # -b refind-bin-$Version.img -c boot.cat -no-emul-boot -boot-load-size 4 \
79 # -eltorito-alt-boot -efi-boot refind-bin-$Version.img \
82 # Create a bootable USB flash drive image, using the FAT filesystem
83 # created above and a stored partition table image (plus some empty
86 # Note: Seems to work on only a few systems, so I'm not distributing
87 # the resulting images yet....
89 rm -f ..
/..
/refind-flashdrive-
$Version.
*
90 let FatSize
=`du -s refind-bin-$Version.img | cut -f 1`
91 let FatSize
=($FatSize)+2048
92 dd if=/dev
/zero of
=..
/..
/refind-flashdrive-
$Version.img bs
=1024 count
=$FatSize
93 sgdisk
-n 1:2048:0 -t 1:EF00
-g ..
/..
/refind-flashdrive-
$Version.img
94 if [[ $?
!= 0 ]] ; then
95 echo "sgdisk failed! Exiting!"
98 dd if=refind-bin-
$Version.img of
=..
/..
/refind-flashdrive-
$Version.img bs
=512 seek
=2048 conv
=notrunc
101 mkdir refind-flashdrive-
$Version
102 ln ..
/refind-flashdrive-
$Version.img refind-flashdrive-
$Version
103 cp $StartDir/README-flashdrive.txt
$StartDir/COPYING.txt
$StartDir/NEWS.txt \
104 $StartDir/CREDITS.txt
$StartDir/LICENSE.txt
$StartDir/SHELLS.txt refind-flashdrive-
$Version
105 zip -9r ..
/refind-flashdrive-
$Version.
zip refind-flashdrive-
$Version
109 # Zip up the optical disc image....
110 rm -f refind-cd-
$Version.
zip
111 zip -9 refind-cd-
$Version.
zip refind-cd-
$Version.iso