Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1153211
  • 博文数量: 209
  • 博客积分: 4069
  • 博客等级: 上校
  • 技术积分: 2025
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-02 13:51
文章分类
文章存档

2011年(2)

2010年(4)

2009年(63)

2008年(140)

我的朋友

分类: LINUX

2008-07-17 18:44:11

             Asterisk RPM包制作

Linux kernel:2.6.18-53.el5
Distribution:CentOS release 5 (Final)
Asterisk:Asterisk-1.6.0-1
源码包:asterisk-1.6.0-beta9.tar.gz

从源码制作rpm包,一般需要我们自己编写spec文件,但是Asterisk源码tar包中已经写好了spec文件,
因此,在将压缩包解压后,可以直接通过命令:./configure && make && make rpm来制作rpm包
asterisk tar包似乎帮我们做好了一切,但是在上述过程中还是出现了问题,
我们自己要做的就是修改asterisk.spec文件

以下是用rpmbuild打包的标准过程:
1. 将asterisk.spec文件放在如下目录:#/usr/src/redhat/SPECS 
   注:spec文件在redhat目录下,我们在其基础上做必要的修改
2. 将原始的asterisk tar包放在如下目录: #/usr/src/redhat/BUILD
3. cd到/usr/src/redhat/SPECS 然后执行rpmbuild -ba asterisk.spec

针对在第三步中不断出现的问题,我对asterisk.spec作了如下修改:
1. 将Copyright: Linux Support Services, inc.一行去掉
2. 在Version附近加上License信息
3. 去掉Buildroot一行(可以不去掉,但是会产生一些问题,简单起见,还是删去)
4. 加上以下内容:
%prep
tar xzvf $RPM_BUILD_DIR/asterisk.tar.gz
#(参考Maxsimun RPM,在rpmbuild过程中有必要解压)
%build
cd $RPM_BUILD_DIR/asterisk-1.6.0-beta9
./configure
make

%install
cd $RPM_BUILD_DIR/asterisk-1.6.0-beta9/
make install
make samples

5. 纠正filelist中出错的文件路径:
%attr(0755,root,root)       /etc/rc.d/init.d/asterisk
替换为%attr(0755,root,root)       /usr/sbin/asterisk


< %attr(0644,root,root)      /var/lib/asterisk/sounds/*.gsm
< %attr(0755,root,root) %dir /var/lib/asterisk/sounds/dictate
< %attr(0644,root,root)      /var/lib/asterisk/sounds/dictate/*.gsm
< %attr(0755,root,root) %dir /var/lib/asterisk/sounds/digits
< %attr(0644,root,root)      /var/lib/asterisk/sounds/digits/*.gsm
< %attr(0755,root,root) %dir /var/lib/asterisk/sounds/letters
< %attr(0644,root,root)      /var/lib/asterisk/sounds/letters/*.gsm
< %attr(0755,root,root) %dir /var/lib/asterisk/sounds/phonetic
< %attr(0644,root,root)      /var/lib/asterisk/sounds/phonetic/*.gsm
< %attr(0755,root,root) %dir /var/lib/asterisk/sounds/silence
< %attr(0644,root,root)      /var/lib/asterisk/sounds/silence/*.gsm
< %attr(0755,root,root) %dir /var/lib/asterisk/mohmp3
< %attr(0644,root,root)      /var/lib/asterisk/mohmp3/*
替换为
> %attr(0644,root,root)      /var/lib/asterisk/sounds/en/*.gsm
> %attr(0755,root,root) %dir /var/lib/asterisk/sounds/en/dictate
> %attr(0644,root,root)      /var/lib/asterisk/sounds/en/dictate/*.gsm
> %attr(0755,root,root) %dir /var/lib/asterisk/sounds/en/digits
> %attr(0644,root,root)      /var/lib/asterisk/sounds/en/digits/*.gsm
> %attr(0755,root,root) %dir /var/lib/asterisk/sounds/en/letters
> %attr(0644,root,root)      /var/lib/asterisk/sounds/en/letters/*.gsm
> %attr(0755,root,root) %dir /var/lib/asterisk/sounds/en/phonetic
> %attr(0644,root,root)      /var/lib/asterisk/sounds/en/phonetic/*.gsm
> %attr(0755,root,root) %dir /var/lib/asterisk/sounds/en/silence
> %attr(0644,root,root)      /var/lib/asterisk/sounds/en/silence/*.gsm
> %attr(0755,root,root) %dir /var/lib/asterisk/moh
> %attr(0644,root,root)      /var/lib/asterisk/moh/*


< %attr(0644,root,root)      /var/spool/asterisk/voicemail/default/1234/*.gsm
替换为
> %attr(0644,root,root)      /var/spool/asterisk/voicemail/default/1234/en/*.gsm

6. 在做好rpmbuild后,会产生两个rpm文件:
  asterisk-1.6.0-1.i386.rpm  && asterisk-devel-CVS-1.i386.rpm,
  我们需要的是前面一个rpm,后面一个暂时还没发现它的用处
  另外,在trixbox上安装rpm包的时候,最好将/etc/asterisk/文件夹移走,
  否则,asterisk 可能无法正常运行。


以下是比较spec文件修改前后,仅供参考:
[root@localhost SPECS]# diff asterisk2.spec asterisk.spec
6c6
< Copyright: Linux Support Services, inc.
---
> License: GPL
10d9
< BuildRoot: /tmp/asterisk
34a34,46
> %prep
> tar xzvf $RPM_BUILD_DIR/asterisk.tar.gz
>
> %build
> cd $RPM_BUILD_DIR/asterisk-1.6.0-beta9
> ./configure
> make
>
> %install
> cd $RPM_BUILD_DIR/asterisk-1.6.0-beta9/
> make install
> make samples
>
47c59,61
< %attr(0755,root,root)       /etc/rc.d/init.d/asterisk
---
>
> #%attr(0755,root,root)       /etc/rc.d/init.d/asterisk
> %attr(0755,root,root)       /usr/sbin/asterisk
82,94c96,108
< %attr(0644,root,root)      /var/lib/asterisk/sounds/*.gsm
< %attr(0755,root,root) %dir /var/lib/asterisk/sounds/dictate
< %attr(0644,root,root)      /var/lib/asterisk/sounds/dictate/*.gsm
< %attr(0755,root,root) %dir /var/lib/asterisk/sounds/digits
< %attr(0644,root,root)      /var/lib/asterisk/sounds/digits/*.gsm
< %attr(0755,root,root) %dir /var/lib/asterisk/sounds/letters
< %attr(0644,root,root)      /var/lib/asterisk/sounds/letters/*.gsm
< %attr(0755,root,root) %dir /var/lib/asterisk/sounds/phonetic
< %attr(0644,root,root)      /var/lib/asterisk/sounds/phonetic/*.gsm
< %attr(0755,root,root) %dir /var/lib/asterisk/sounds/silence
< %attr(0644,root,root)      /var/lib/asterisk/sounds/silence/*.gsm
< %attr(0755,root,root) %dir /var/lib/asterisk/mohmp3
< %attr(0644,root,root)      /var/lib/asterisk/mohmp3/*
---
> %attr(0644,root,root)      /var/lib/asterisk/sounds/en/*.gsm
> %attr(0755,root,root) %dir /var/lib/asterisk/sounds/en/dictate
> %attr(0644,root,root)      /var/lib/asterisk/sounds/en/dictate/*.gsm
> %attr(0755,root,root) %dir /var/lib/asterisk/sounds/en/digits
> %attr(0644,root,root)      /var/lib/asterisk/sounds/en/digits/*.gsm
> %attr(0755,root,root) %dir /var/lib/asterisk/sounds/en/letters
> %attr(0644,root,root)      /var/lib/asterisk/sounds/en/letters/*.gsm
> %attr(0755,root,root) %dir /var/lib/asterisk/sounds/en/phonetic
> %attr(0644,root,root)      /var/lib/asterisk/sounds/en/phonetic/*.gsm
> %attr(0755,root,root) %dir /var/lib/asterisk/sounds/en/silence
> %attr(0644,root,root)      /var/lib/asterisk/sounds/en/silence/*.gsm
> %attr(0755,root,root) %dir /var/lib/asterisk/moh
> %attr(0644,root,root)      /var/lib/asterisk/moh/*
124c138
< %attr(0644,root,root)      /var/spool/asterisk/voicemail/default/1234/*.gsm
---
> %attr(0644,root,root)      /var/spool/asterisk/voicemail/default/1234/en/*.gsm





阅读(1610) | 评论(0) | 转发(0) |
0

上一篇:job hunting

下一篇:用checkinstall制作rpm包

给主人留下些什么吧!~~