centos7 编译打包bcache-tools
centos7 build bcache-tools
获取源码
centos 本身不提供bcache-tools的rpm,所以需要自己build。
从fedora下载源码,也可以从github社区下载, 从fedora下载主要是需要spec文件,方便build rpm包.
bcache-tools-1.0.8-17.fc32.src.rpm
build
#rpm -ivh bcache-tools-1.0.8-17.fc32.src.rpm
#cd ~/rpmbuild/SPECS/
把下面的diff patch:应用到bcache-tools.spec文件
45,46c45
< Requires: libblkid >= 2.24
< Conflicts: dracut < 034
---
> Requires: libblkid
65c64
< %patch3 -p1 -b .noprobe
---
> #%patch3 -p1 -b .noprobe
90,96d88
< # prevent complaints when checking for unpackaged files
< rm %{buildroot}%{_udevlibdir}/probe-bcache
< rm %{buildroot}%{_mandir}/man8/probe-bcache.8
< rm %{buildroot}%{_prefix}/lib/initcpio/install/bcache
< rm %{buildroot}%{_datarootdir}/initramfs-tools/hooks/bcache
<
<
104a97
> %{_udevlibdir}/probe-bcache
108a102,103
> %{_prefix}/lib/initcpio/install/bcache
> %{_datarootdir}/initramfs-tools/hooks/bcache
#rpmbuild -ba bcache-tools.spec
build出bcache-tools的rpm包 bcache-tools-1.0.8-17.el7.centos.x86_64
安装
安装依赖
- yum install libblkid
安装
- rpm -ivh bcache-tools-1.0.8-17.el7.centos.x86_64.rpm
会出现下面的错误:
preparing... ################################# [100%]
file /usr/lib/dracut/modules.d/90bcache/module-setup.sh from install of bcache-tools-1.0.8-17.el7.centos.x86_64 conflicts with file from package dracut-033-502.el7.x86_64
是因为bcache-tools安装的module-setup.sh和dracut里的冲突, 直接覆盖安装即可
- rpm -ivh bcache-tools-1.0.8-17.el7.centos.x86_64.rpm --replacefiles