3 # Script to prepare source code and binary distribution files of rEFInd.
4 # By Rod Smith, 3/11/2012
5 # Updated 11/8/2012 to do more things automatically
6 # Updated 12/6/2012 to sign binaries with the rEFInd MOK
8 # Usage: ./mkdistrib version [--nosign]
9 # where "version" is a version number
10 # MUST be run from an x86-64 system, on which the TianoCore build
11 # includes both X64 and IA32 build support ("TARGET_ARCH = IA32 X64"
12 # in Conf/target.txt). The MOK files must be available from a disk
13 # partition to be mounted via /etc/fstab at /mnt/refind.
16 if [[ $2 == "--nosign" ]] ; then
23 SBSign
=`which sbsign 2> /dev/null`
26 KeysInfo
=`df $KeysDir 2> /dev/null | grep $KeysDir`
28 if [[ ! -n $SBSign && $SignIt == 1 ]] ; then
29 echo "Can't find sbsign binary! Aborting!"
33 if [[ ! -n $KeysInfo && $SignIt == 1 ]] ; then
35 if [[ $?
-ne 0 ]] ; then
36 echo "Error mounting $KeysDir! Aborting!"
42 # From here on, if there's an error, abort immediately.
47 # Remove temporary files from the "debian" subdirectory
48 rm -rf debian
/refind debian
/*.log
50 # Prepare a place and copy files there....
51 mkdir
-p ..
/snapshots
/$1/refind-
$1/icons
52 cp --preserve=timestamps icons
/*png ..
/snapshots
/$1/refind-
$1/icons
/
53 cp -a debian docs images keys fonts banners include EfiLib libeg mok net refind filesystems gptsync refind.spec
install.sh mkrlconf.sh mvrefind.sh CREDITS.txt NEWS.txt BUILDING.txt COPYING.txt LICENSE.txt README.txt refind.inf Make.tiano Make.common Makefile refind.conf-sample ..
/snapshots
/$1/refind-
$1
55 # Go there and prepare a souce code zip file....
57 rm -f refind-src-
$1.
zip
58 zip -9r refind-src-
$1.
zip refind-
$1
60 # Build the IA32 binaries
64 mkdir
-p refind-bin-
$1/refind
/drivers_ia32
65 cp --preserve=timestamps drivers_ia32
/*_ia32.efi refind-bin-
$1/refind
/drivers_ia32
/
66 cp --preserve=timestamps filesystems
/LICENSE
*txt refind-bin-
$1/refind
/drivers_ia32
/
67 cp refind
/refind_ia32.efi refind-bin-
$1/refind
/refind_ia32.efi
68 cp refind
/refind_ia32.efi
$StartDir/
69 mkdir
-p refind-bin-
$1/refind
/tools_ia32
70 cp --preserve=timestamps gptsync
/gptsync_ia32.efi refind-bin-
$1/refind
/tools_ia32
/
72 # Build the X64 binaries
76 mkdir
-p refind-bin-
$1/refind
/drivers_x64
77 cp -a icons refind-bin-
$1/refind
/
78 if [[ $SignIt == 1 ]] ; then
79 for File
in `ls drivers_x64/*_x64.efi` ; do
80 $SBSign --key $KeysDir/refind.key
--cert $KeysDir/refind.crt
--output refind-bin-
$1/refind
/$File $File
83 cp --preserve=timestamps drivers_x64
/*_x64.efi refind-bin-
$1/refind
/drivers_x64
/
85 cp --preserve=timestamps filesystems
/LICENSE
*txt refind-bin-
$1/refind
/drivers_x64
/
86 cp --preserve=timestamps refind.conf-sample refind-bin-
$1/refind
/
87 if [[ $SignIt == 1 ]] ; then
88 $SBSign --key $KeysDir/refind.key
--cert $KeysDir/refind.crt
--output refind-bin-
$1/refind
/refind_x64.efi refind
/refind_x64.efi
90 cp refind
/refind_x64.efi refind-bin-
$1/refind
/refind_x64.efi
92 mkdir
-p refind-bin-
$1/refind
/tools_x64
93 if [[ $SignIt == 1 ]] ; then
94 $SBSign --key $KeysDir/refind.key
--cert $KeysDir/refind.crt
--output refind-bin-
$1/refind
/tools_x64
/gptsync_x64.efi gptsync
/gptsync_x64.efi
96 cp --preserve=timestamps gptsync
/gptsync_x64.efi refind-bin-
$1/refind
/tools_x64
/
98 cp refind-bin-
$1/refind
/refind_x64.efi
$StartDir
99 cp -a docs keys banners fonts COPYING.txt LICENSE.txt README.txt CREDITS.txt NEWS.txt
install.sh mkrlconf.sh mvrefind.sh refind-bin-
$1
101 # Prepare the final .zip file
102 zip -9r ..
/refind-bin-
$1.
zip refind-bin-
$1
104 # Prepare a variant with the x86-64 version built with GNU-EFI....
107 if [[ $SignIt == 1 ]] ; then
108 $SBSign --key $KeysDir/refind.key
--cert $KeysDir/refind.crt
--output refind-bin-
$1/refind
/refind_x64.efi refind
/refind_x64.efi
110 cp refind
/refind_x64.efi refind-bin-
$1/refind
/refind_x64.efi
112 zip -9r ..
/refind-bin-gnuefi-
$1.
zip refind-bin-
$1
118 # Prepare the RPM & Debian package files
119 cp refind-src-
$1.
zip ~
/rpmbuild
/SOURCES
/
120 rpmbuild
-ba $StartDir/refind.spec
121 mv ~
/rpmbuild
/RPMS
/*/refind-
$1* .
/
122 mv ~
/rpmbuild
/SRPMS
/refind-
$1* .
/
123 sudo alien
--to-deb -k -c refind-
$1*x86_64.rpm
124 sudo chown rodsmith
: refind
*deb
125 rm ~
/rpmbuild
/SOURCES
/refind-src-
$1.
zip
128 if [[ $SignIt == 1 ]] ; then