CentOS下 helloworld rpm制作参考
http://www.jb51.cc/article/p-kdqjkira-wk.html
请务必先学会如何制作rpm,再看本文
修改源文件,生成补丁文件
/SOURCES 下是原来的的tar.gz
明确一点,我们拥有原来的文件,加上补丁文件(补丁就是新与就的区别),就可以重新生成一个新的rpm了,而不是直接新的所有文件
SOUCES下的文件
这里有两个patch方法
- diff -uNr helloworld helloworld.new > helloworld-test.patch
查看patch
tar包对比生成patch,命令类似
但是 cat看不到信息
修改spec文件,添加补丁,重新rpmbuild
spec文件可以备份下,然后修改下spect文件
完整内容如下
- Summary:the first rpm
- Name:helloworld
- Version:0.1
- Release:1%{?dist}
- Vendor:john
- License:Share
- Group:Applications/Text
- Source0:helloworld-0.1-1.tar.gz
-
- # add patch
- patch0:helloworld-test.patch
- %description
- rpm test helloworld
- %prep
- export RPM_SOURCES_DIR=/root/rpmbuild/SOURCES
- export RPM_BUILD_DIR=/root/rpmbuild/BUILD
- tar -xzvf $RPM_SOURCES_DIR/helloworld-0.1-1.tar.gz
- %patch0 -p0
- %build
- cd $RPM_BUILD_DIR/helloworld
- ./configure
- make
- %install
- cd $RPM_BUILD_DIR/helloworld
- make install
- mkdir -p /root/rpmbuild/BUILDROOT/helloworld-0.1-1.el6.x86_64/usr/bin/
- cp $RPM_BUILD_DIR/helloworld/helloworld /root/rpmbuild/BUILDROOT/helloworld-0.1-1.el6.x86_64/usr/bin/
- %clean
- rm -rf $RPM_BUILD_DIR/helloworld
- %files
- %defattr(-,root,root)
- /usr/bin/helloworld
- %doc $RPM_BUILD_DIR/helloworld/readme
最后rpmbuild -ba spec,验证结果
参考文章
这篇文章看着很好,但不清晰,不知道怎么照着做,只能稍微看看
http://blog.chinaunix.net/uid-21123336-id-1830529.html
这篇文章,了解下patch,以及不会的linux patch命令
http://www.jb51.cc/article/p-obyjdegk-mg.html
linux rpm命令
http://man.linuxde.net/rpm