]> code.delx.au - refind/blob - mkcdimage
Modified sample configuration file to reflect deprecation of "fs#:"
[refind] / mkcdimage
1 #!/bin/bash
2 #
3 # Script to create a bootable CD image file containing rEFInd.
4 # Usage:
5 #
6 # ./mkcdimage {version}
7 #
8 # where {version} is the rEFInd version number.
9 #
10 # This script relies on the mcopy utility.
11 #
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
16
17 StartDir=`pwd`
18 Version=$1
19
20 # Unzip the binary archive file....
21 cd ../snapshots/$Version
22 rm -rf temp
23 mkdir temp
24 cd temp
25 unzip ../refind-bin-$Version.zip
26 cp $StartDir/SHELLS.txt ./refind-bin-$Version
27
28 # Create a boot directory and (temporarily) copy the EFI shell
29 # files to it....
30 mkdir -p refind-bin-$Version/EFI/boot
31 cd refind-bin-$Version/EFI/boot
32 cp $StartDir/shell*.efi ./
33
34 # Create hard links to the rEFInd files so that they'll be suitable for an
35 # EFI-boot CD...
36 ln ../../refind/refind_ia32.efi ./bootia32.efi
37 ln ../../refind/refind_x64.efi ./bootx64.efi
38 ln ../../refind/refind.conf-sample ./refind.conf
39 mkdir icons
40 cd icons
41 ln ../../../refind/icons/* ./
42 cd ../
43 mkdir drivers_x64
44 cd drivers_x64
45 ln ../../../refind/drivers_x64/* ./
46 cd ..
47 mkdir drivers_ia32
48 cd drivers_ia32
49 ln ../../../refind/drivers_ia32/* ./
50 cd ../../..
51
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
56
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 ./
60
61 # Prepare a FAT filesystem image and populate it with the
62 # EFI boot files....
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 ::/
66
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 \
71 -no-emul-boot ./
72
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 \
80 # -no-emul-boot ./
81
82 # Create a bootable USB flash drive image, using the FAT filesystem
83 # created above and a stored partition table image (plus some empty
84 # sectors)....
85 #
86 # Note: Seems to work on only a few systems, so I'm not distributing
87 # the resulting images yet....
88 #
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!"
96 exit 1
97 fi
98 dd if=refind-bin-$Version.img of=../../refind-flashdrive-$Version.img bs=512 seek=2048 conv=notrunc
99
100 cd ..
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
106
107 cd ../
108
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
112
113 rm -r temp/