Checkinstall 是一个能从 tar.gz类的源代码自动生成RPM/Debian或Slackware安装包的程序。
用checkinstall制作rpm包只有简单的几步,但是这过程中可能会出现一些问题。
具体的步骤:
1.tar xzvf asterisk-1.6.0-beta9.tar.gz
2. cd asterisk-1.6.0-beta9
3. ./configure
4. make
5. checkinstall -R --fstrans=no --inspect --review-spec --review-control
6. rpm -ivh --nomd5 asterisk-1.6.0-beta9-1.i386.rpm
参数介绍:
-R Build a RPM package
--fstrans= Enable/disable the filesystem translation code
--inspect Inspect the package's file list
--review-spec Review the spec file before creating a .rpm
--review-control Review the control file before creating a .deb
具体说一下制作rpm包中遇到的问题:
1.1 将第5步改为 checkinstall -R
/usr/bin/install: warning: failed to change context of /var/lib/asterisk/static-http/docs/asterisk.css to : Invalid argument
/usr/bin/install: warning: failed to change context of /var/lib/asterisk/static-http/docs/asterisk.html to : Invalid argument
/usr/bin/install: warning: failed to change context of /var/lib/asterisk/static-http/docs/images.aux to : Invalid argument
/usr/bin/install: warning: failed to change context of /var/lib/asterisk/static-http/docs/images.log to : Invalid argument
/usr/bin/install: warning: failed to change context of /var/lib/asterisk/static-http/docs/images.out to : Invalid argument
/usr/bin/install: warning: failed to change context of /var/lib/asterisk/static-http/docs/images.pl to : Invalid argument
/usr/bin/install: warning: failed to change context of /var/lib/asterisk/static-http/docs/images.tex to : Invalid argument
1.2 在checkinstall的邮件列表中我问了一下1.1中问题的解决方法: checkinstall -R --fstrans=no
修改后,在生成rpm包的过程中没出现什么严重问题,但安装rpm包时产生了“file conflict”:
Preparing... ########################################### [100%]
file /usr/libexec/gcc/i386-redhat-linux/4.1.2 from install of asterisk-beta9-1 conflicts with file from package cpp-4.1.2-14.el5
file /usr/libexec/gcc/i386-redhat-linux/4.1.2 from install of asterisk-beta9-1 conflicts with file from package gcc-4.1.2-14.el5
file /usr/libexec/gcc/i386-redhat-linux/4.1.2 from install of asterisk-beta9-1 conflicts with file from package gcc-c++-4.1.2-14.el5
file /usr/libexec/gcc/i386-redhat-linux/4.1.2 from install of asterisk-beta9-1 conflicts with file from package gcc-gfortran-4.1.2-14.el5
.......
1.3 通过邮件列表的帮助和网上查资料,需要我们手动修改spec文件中的file list,为此,我们需要加上参数--inspect:
checkinstall -R --fstrans=no --inspect
对于如何修改file list,我没有什么好的方法,目前能做的就是将1.2中file conflict中相关的文件剔除掉,在用checkinstall生成rpm的过程中会有这一步的:
You requested to review the list of files that will be
included in this package.
Now you'll have the chance to review and optionally modify it.
得到的结果:
Building RPM package...OK
NOTE: The package will not be installed
注:可能有人会担心将这些文件剔除会不会产生问题,这是别人给我的回答:
“I told you that because I had some problems with some packages, I dont
know the reason but sometimes checkinstall include like /usr/bin/make
or /etc/selinux ...etc.. thats problem.“
1.4 将得到的rpm包进行安装:
[root@localhost i386]# rpm -ivh asterisk-1.6.0-beta9-1.i386.rpm
Preparing... ########################################### [100%]
1:asterisk-1.6.0 ########################################### [100%]
error: unpacking of archive failed on file /bin/basename;4877040f: cpio: MD5 sum mismatch
1.5 按照网上的说法,这是checkinstall软件存在的bug,相应的workaround是在安装是加上参数:--nomd5
[root@localhost i386]# rpm -ivh --nomd5 asterisk-1.6.0-beta9-1.i386.rpm
Preparing... ########################################### [100%]
1:asterisk-1.6.0 ########################################### [100%]
error: unpacking of archive failed on file /selinux/context;48770513: cpio: open failed - Permission denied
1.6 1.4中的问题没了,1.5中有了新的问题,只好一个一个解决罗。
对于1.5中的error,网上也有类似的例子,解决的方案是在checkinstallrc文件中加入
EXCLUDE="/selinux"
按这种方法做后,问题还是没有解决,我的解决方法是:
在file list中将/selinux/content去掉
重新./configure,make,checkinstall后,安装rpm包:
[root@localhost i386]# rpm -ivh --nomd5 asterisk-1.6.0-1.i386.rpm
Preparing... ########################################### [100%]
1:asterisk ########################################### [100%]
[root@localhost i386]#
终于大功告成了,基本步骤也就这么些了,可能还会有其他问题,网上还是能找到答案的。
1.7 在安装过程中,还会输入一些软件包的相关信息,如name, version, source,这些都可以定制。有些可能需要更改。如在我这个实例中,checkinstall默认的name是asterisk-1.6.0,将版本号也包括在其中了,我们可以不进行修改。但是在安装完asterisk rpm包后,如果我们查询rpm -q asterisk,会得不到结果,只能查询rpm -a asterisk-1.6.0。所以,这个还是有必要改一下。
阅读(2411) | 评论(0) | 转发(0) |