| 1 |
#! /bin/sh |
| 2 |
# |
| 3 |
# This is a kernel build script for CentOS Stream 8's 4.18 kernel. |
| 4 |
# |
| 5 |
|
| 6 |
die () { |
| 7 |
echo $1 |
| 8 |
exit 1 |
| 9 |
} |
| 10 |
|
| 11 |
cd /tmp/ || die "Can't chdir to /tmp/ ." |
| 12 |
|
| 13 |
if [ ! -r kernel-4.18.0-448.el8.src.rpm ] |
| 14 |
then |
| 15 |
wget https://vault.centos.org/centos/8-stream/BaseOS/Source/SPackages/kernel-4.18.0-448.el8.src.rpm || die "Can't download source package." |
| 16 |
fi |
| 17 |
LANG=C rpm --checksig kernel-4.18.0-448.el8.src.rpm | grep -F ': digests signatures OK' || die "Can't verify signature." |
| 18 |
rpm -ivh kernel-4.18.0-448.el8.src.rpm || die "Can't install source package." |
| 19 |
|
| 20 |
cd ~/rpmbuild/SOURCES/ || die "Can't chdir to ~/rpmbuild/SOURCES/ ." |
| 21 |
if [ ! -r caitsith-patch-0.2-20231225.tar.gz ] |
| 22 |
then |
| 23 |
wget https://sourceforge.net/projects/tomoyo/files/caitsith-patch/0.2/caitsith-patch-0.2-20231225.tar.gz || die "Can't download patch." |
| 24 |
fi |
| 25 |
|
| 26 |
cd ~/rpmbuild/SPECS/ || die "Can't chdir to ~/rpmbuild/SPECS/ ." |
| 27 |
cp -p kernel.spec cs-kernel.spec || die "Can't copy spec file." |
| 28 |
patch << "EOF" || die "Can't patch spec file." |
| 29 |
--- cs-kernel.spec |
| 30 |
+++ cs-kernel.spec |
| 31 |
@@ -35,7 +35,7 @@ |
| 32 |
%global zipsed -e 's/\.ko$/\.ko.xz/' |
| 33 |
%endif |
| 34 |
|
| 35 |
-# define buildid .local |
| 36 |
+%define buildid _caitsith_0.2.11 |
| 37 |
|
| 38 |
%define rpmversion 4.18.0 |
| 39 |
%define pkgrelease 448.el8 |
| 40 |
@@ -1085,6 +1085,10 @@ |
| 41 |
|
| 42 |
# END OF PATCH APPLICATIONS |
| 43 |
|
| 44 |
+# CaitSith |
| 45 |
+tar -zxf %_sourcedir/caitsith-patch-0.2-20231225.tar.gz |
| 46 |
+sed -i -e 's/CCSECURITY/CAITSITH/g' -e 's/ccsecurity/caitsith/g' -e 's/ccs_domain_info/cs_domain_info/g' -e 's/ccs_flags/cs_flags/g' patches/ccs-patch-*.diff |
| 47 |
+patch -sp1 < patches/ccs-patch-4.18-centos-8.diff |
| 48 |
# Any further pre-build tree manipulations happen here. |
| 49 |
|
| 50 |
%if %{with_realtime} |
| 51 |
@@ -1212,6 +1216,9 @@ |
| 52 |
cp %{SOURCE9} certs/. |
| 53 |
%endif |
| 54 |
|
| 55 |
+ # CaitSith |
| 56 |
+ sed -e 's@/sbin/init@/usr/lib/systemd/systemd@' -- config.caitsith >> .config |
| 57 |
+ |
| 58 |
Arch=`head -1 .config | cut -b 3-` |
| 59 |
echo USING ARCH=$Arch |
| 60 |
|
| 61 |
EOF |
| 62 |
echo "" |
| 63 |
echo "" |
| 64 |
echo "" |
| 65 |
echo "Edit ~/rpmbuild/SPECS/cs-kernel.spec if needed, and run" |
| 66 |
echo "rpmbuild -bb ~/rpmbuild/SPECS/cs-kernel.spec" |
| 67 |
echo "to build kernel rpm packages." |
| 68 |
echo "" |
| 69 |
ARCH=`uname -m` |
| 70 |
echo "I'll start 'rpmbuild -bb --target $ARCH --with baseonly --without debug --without debuginfo ~/rpmbuild/SPECS/cs-kernel.spec' in 30 seconds. Press Ctrl-C to stop." |
| 71 |
sleep 30 |
| 72 |
exec rpmbuild -bb --target $ARCH --with baseonly --without debug --without debuginfo ~/rpmbuild/SPECS/cs-kernel.spec |
| 73 |
exit 0 |