2022-03-30 10:03:27 +00:00

109 lines
2.8 KiB
RPMSpec

%global debug_package %{nil}
# macros for finding system files to update at install time (pci.ids, pcitable)
%define find() %(for f in %*; do if [ -e $f ]; then echo $f; break; fi; done)
Name: TCP_option_address
Summary: Intel(R) Ethernet Adaptive Virtual Function Driver
Version: 1.0.0
Release: 1
#Release: 0.%{krelver}
Vendor: Huawei
License: GPL-2.0
URL: https://github.com/dongzerun/TCP_option_address
Source0: TCP_option_address.tar.gz
Patch0001: 0001-support-arm64.patch
Patch0002: 0002-fix-build-error.patch
Patch0003: 0003-patch-for-5_10.patch
Requires: kernel, findutils, gawk, bash
BuildRequires: kernel-devel hwdata elfutils-devel gcc
%description
The TCP Option Address (TOA) module is a kernel module that obtains the source IPv4 address from the option section of a TCP header.
%prep
%autosetup -n %{name} -p1
%build
make -C src clean
make -C src
%install
make -C src DESTDIR=%{buildroot} install
# Remove modules files that we do not want to include
find %{buildroot}/lib/modules/ -name 'modules.*' -exec rm -f {} \;
cd %{buildroot}
find lib -name "toa" \
-fprintf %{_builddir}/%{name}/file.list "/%p\n"
%clean
rm -rf %{buildroot}
%files -f file.list
%defattr(-,root,root)
%doc README.md file.list
%license LICENSE NOTICE
%post
uname -r | grep BOOT || /sbin/depmod -a > /dev/null 2>&1 || true
if which dracut >/dev/null 2>&1; then
echo "Updating initramfs with dracut..."
if dracut --force ; then
echo "Successfully updated initramfs."
else
echo "Failed to update initramfs."
echo "You must update your initramfs image for changes to take place."
exit -1
fi
elif which mkinitrd >/dev/null 2>&1; then
echo "Updating initrd with mkinitrd..."
if mkinitrd; then
echo "Successfully updated initrd."
else
echo "Failed to update initrd."
echo "You must update your initrd image for changes to take place."
exit -1
fi
else
echo "Unable to determine utility to update initrd image."
echo "You must update your initrd manually for changes to take place."
exit -1
fi
%preun
%postun
uname -r | grep BOOT || /sbin/depmod -a > /dev/null 2>&1 || true
if which dracut >/dev/null 2>&1; then
echo "Updating initramfs with dracut..."
if dracut --force ; then
echo "Successfully updated initramfs."
else
echo "Failed to update initramfs."
echo "You must update your initramfs image for changes to take place."
exit -1
fi
elif which mkinitrd >/dev/null 2>&1; then
echo "Updating initrd with mkinitrd..."
if mkinitrd; then
echo "Successfully updated initrd."
else
echo "Failed to update initrd."
echo "You must update your initrd image for changes to take place."
exit -1
fi
else
echo "Unable to determine utility to update initrd image."
echo "You must update your initrd manually for changes to take place."
exit -1
fi
%changelog
* Mon Jan 24 2022 jiaofenfang<jiaofenfang@uniontech.com> - 1.0.0-1
- Package init