This repository has been archived by the owner on Jul 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·81 lines (68 loc) · 1.92 KB
/
build
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
#!/bin/sh
# Change these when there's a new kernel or firmware version
kver=3.10.0-693.11.6
fver=20170606-57.gitc990aae
# Sadly, you may have to change these URLs when new versions of the OS are
# released, since there won't be an 'updates' directory at first.I wish
# there was a way to do this that didn't require that.
KBASEURL=http://mirror.centos.org/centos-7/7/updates/x86_64/Packages
FBASEURL=http://mirror.centos.org/centos-7/7/updates/x86_64/Packages
# You shouldn't have to change anything below here
set -e -E
top=`pwd`
workdir="$top/work"
outdir="$top/output"
KSOURCES="
kernel-$kver.el7.x86_64.rpm
kernel-abi-whitelists-$kver.el7.noarch.rpm
kernel-debug-$kver.el7.x86_64.rpm
kernel-debug-devel-$kver.el7.x86_64.rpm
kernel-devel-$kver.el7.x86_64.rpm
kernel-doc-$kver.el7.noarch.rpm
kernel-headers-$kver.el7.x86_64.rpm
"
FSOURCES="
linux-firmware-$fver.el7.noarch.rpm
"
download() {
if [ -f "sources/$1" ]; then
echo " Not downloading: $1"
else
echo " Downloading: $1"
if ! curl -s -f $2 -o sources/$1; then
echo "ERROR: Failed to download $1 (curl returned $?)"
exit 1
fi
fi
echo -n " "
if ! (cd sources; rpm -K $1); then
echo "ERROR: Failed to verify $1 (rpm -K returned $?)"
exit 1
fi
}
mkdir -p sources
rpm --import RPM-GPG-KEY-CentOS-7
echo "Downloading sources:"
for i in $KSOURCES
do
download "$i" "$KBASEURL/$i"
done
for i in $FSOURCES
do
download "$i" "$FBASEURL/$i"
done
echo
echo "Source files all ok, building:"
rpmbuild -bb \
--define "_topdir $top" \
--define "_rpmdir $outdir" \
--define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
--define "_sourcedir $top/sources" \
--define "_specdir $top" \
--define "_srcrpmdir $outdir" \
--define "_builddir $workdir/BUILD" \
--define "_buildrootdir $workdir/BUILDROOT" \
kernel-bp-3.10.spec
if [ $? -eq 0 ]; then
rm -rf "$workdir"
fi