Saturday, October 21, 2006

Build your own RPM

Many a times while installing packages in linux , we have two options
either a rpm package or a tar file which needs to be uncompressed and
running commands like configure, make , make install.

I had just downloaded a Linux Flash Plugin which was in a tar format.

I followed the below steps to pack it as RPM :
1) cd /usr/src/redhat/SOURCES and copy
your tar(Flash-7.tar.gz) file here,
make sure
while copying the tar file is in Name-Version format.


2) create a flash.spec file on the above path.

3) run rpmbuild -ba and the spec file

Step 1 :
cd /usr/src/redhat/SOURCES and I copied the tar file
as Flash-7.tar.gz

Step 2: Flash.spec file

Summary: GNU Srirams Flash
Name: Flash
Version: 7
Release: 1
Source0: %{name}-%{version}.tar.gz
License: GPL
Group: Multimedia
%description
Allows you to run Flash based programs in Linux
%prep
%setup -q
%build
./flashplayer-installer
%install
%files
%defattr(-,root,root)

Step 3 : Building the RPM
[root@sriram SOURCES]# rpmbuild -ba flash.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.31439
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf Flash-7
+ tar -xf /usr/src/redhat/SOURCES/Flash-7.tar.gz
+ cd Flash-7
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chown -Rhf root .
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chgrp -Rhf root .
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.31439
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd Flash-7
+ LANG=C
+ export LANG
+ unset DISPLAY
+ ./flashplayer-installer

Copyright(C) 2002-2003 Macromedia, Inc. All rights reserved.

Macromedia Flash Player 7 for Linux

This will run the flashplayer-installer

The Macromedia Flash Player installation is complete.

+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.17690
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd Flash-7
+ LANG=C
+ export LANG
+ unset DISPLAY
+ /usr/lib/rpm/find-debuginfo.sh /usr/src/redhat/BUILD/Flash-7
0 blocks
find: /usr/lib/debug: No such file or directory
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
Processing files: Flash-7-1
Processing files: Flash-debuginfo-7-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files %{buildroot}
Wrote: /usr/src/redhat/SRPMS/Flash-7-1.src.rpm
Wrote: /usr/src/redhat/RPMS/i386/Flash-7-1.i386.rpm
Wrote: /usr/src/redhat/RPMS/i386/Flash-debuginfo-7-1.i386.rpm

[root@sriram SOURCES]# rpm -ivh Flash-7-1.i386.rpm
Preparing... ############################## [100%]
1:Flash ############################## [100%]
[root@sriram SOURCES]# rpm -qa |grep Flash
Flash-7-1