-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkdistrib
executable file
·133 lines (114 loc) · 4.36 KB
/
mkdistrib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
#
# Script to prepare source code and binary distribution files of rEFInd.
# By Rod Smith, 3/11/2012
# Updated 11/8/2012 to do more things automatically
# Updated 12/6/2012 to sign binaries with the rEFInd MOK
#
# Usage: ./mkdistrib version [--nosign]
# where "version" is a version number
# MUST be run from an x86-64 system, on which the TianoCore build
# includes both X64 and IA32 build support ("TARGET_ARCH = IA32 X64"
# in Conf/target.txt). The MOK files must be available from a disk
# partition to be mounted via /etc/fstab at /mnt/refind.
if [[ $2 == "--nosign" ]] ; then
SignIt=0
else
SignIt=1
fi
StartDir=`pwd`
SBSign=`which sbsign 2> /dev/null`
KeysDir=/mnt/refind
KeysInfo=`df $KeysDir 2> /dev/null | grep $KeysDir`
if [[ ! -n $SBSign && $SignIt == 1 ]] ; then
echo "Can't find sbsign binary! Aborting!"
exit 1
fi
if [[ ! -n $KeysInfo && $SignIt == 1 ]] ; then
mount /mnt/refind
if [[ $? -ne 0 ]] ; then
echo "Error mounting $KeysDir! Aborting!"
echo ""
exit 1
fi
fi
# From here on, if there's an error, abort immediately.
set -e
make clean
# Remove temporary files from the "debian" subdirectory
rm -rf debian/refind debian/*.log
# Prepare a place and copy files there....
mkdir -p ../snapshots/$1/refind-$1/icons
cp --preserve=timestamps icons/*png ../snapshots/$1/refind-$1/icons/
cp -a debian docs images keys fonts banners include EfiLib libeg mok 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
# Go there and prepare a souce code zip file....
cd ../snapshots/$1/
rm -f refind-src-$1.zip
zip -9r refind-src-$1.zip refind-$1
# Build the IA32 binaries
cd refind-$1
ARCH=ia32 make -j1
ARCH=ia32 make fs
mkdir -p refind-bin-$1/refind/drivers_ia32
cp --preserve=timestamps drivers_ia32/*_ia32.efi refind-bin-$1/refind/drivers_ia32/
cp --preserve=timestamps filesystems/LICENSE*txt refind-bin-$1/refind/drivers_ia32/
cp refind/refind_ia32.efi refind-bin-$1/refind/refind_ia32.efi
cp refind/refind_ia32.efi $StartDir/
mkdir -p refind-bin-$1/refind/tools_ia32
cp --preserve=timestamps gptsync/gptsync_ia32.efi refind-bin-$1/refind/tools_ia32/
# Build the X64 binaries
make clean
make -j1
make fs
mkdir -p refind-bin-$1/refind/drivers_x64
cp -a icons refind-bin-$1/refind/
if [[ $SignIt == 1 ]] ; then
for File in `ls drivers_x64/*_x64.efi` ; do
$SBSign --key $KeysDir/refind.key --cert $KeysDir/refind.crt --output refind-bin-$1/refind/$File $File
done
else
cp --preserve=timestamps drivers_x64/*_x64.efi refind-bin-$1/refind/drivers_x64/
fi
cp --preserve=timestamps filesystems/LICENSE*txt refind-bin-$1/refind/drivers_x64/
cp --preserve=timestamps refind.conf-sample refind-bin-$1/refind/
if [[ $SignIt == 1 ]] ; then
$SBSign --key $KeysDir/refind.key --cert $KeysDir/refind.crt --output refind-bin-$1/refind/refind_x64.efi refind/refind_x64.efi
else
cp refind/refind_x64.efi refind-bin-$1/refind/refind_x64.efi
fi
mkdir -p refind-bin-$1/refind/tools_x64
if [[ $SignIt == 1 ]] ; then
$SBSign --key $KeysDir/refind.key --cert $KeysDir/refind.crt --output refind-bin-$1/refind/tools_x64/gptsync_x64.efi gptsync/gptsync_x64.efi
else
cp --preserve=timestamps gptsync/gptsync_x64.efi refind-bin-$1/refind/tools_x64/
fi
cp refind-bin-$1/refind/refind_x64.efi $StartDir
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
# Prepare the final .zip file
zip -9r ../refind-bin-$1.zip refind-bin-$1
# Prepare a variant with the x86-64 version built with GNU-EFI....
make clean
make -j1 gnuefi
if [[ $SignIt == 1 ]] ; then
$SBSign --key $KeysDir/refind.key --cert $KeysDir/refind.crt --output refind-bin-$1/refind/refind_x64.efi refind/refind_x64.efi
else
cp refind/refind_x64.efi refind-bin-$1/refind/refind_x64.efi
fi
zip -9r ../refind-bin-gnuefi-$1.zip refind-bin-$1
# Clean up....
cd ..
rm -r refind-$1
# Prepare the RPM & Debian package files
cp refind-src-$1.zip ~/rpmbuild/SOURCES/
rpmbuild -ba $StartDir/refind.spec
mv ~/rpmbuild/RPMS/*/refind-$1* ./
mv ~/rpmbuild/SRPMS/refind-$1* ./
sudo alien --to-deb -k -c refind-$1*x86_64.rpm
sudo chown rodsmith: refind*deb
rm ~/rpmbuild/SOURCES/refind-src-$1.zip
# Clean up
if [[ $SignIt == 1 ]] ; then
umount $KeysDir
fi
# Finish
cd $StartDir