ruggar
asked on
Create RPM from already compiled and tar.gz file
I have been tasked with taking a suite of software tools we develop in-house that is provided to me pre-compiled and as a .tar.gz file and creating a simple binary RPM installer. The software has no external dependancies. Our typical install procedures is to untar the tar directories to a location. It is all stand alone with no external dependancies.
Is this even possible? I don't have access to the source since I am not on the development team. I have the tar file and can untar the directory structure to get the precompiled toolset directory structure. But they basically want a binary RPM file to function like an un-tar so the end user just has to double click the RPM file and BOOM all our software is in the proper place.
Example directory structure
/local/Tools/lib
/local/Tools/bin
/local/Tools/scripts
/local/Tools/resources
Is this even possible? I don't have access to the source since I am not on the development team. I have the tar file and can untar the directory structure to get the precompiled toolset directory structure. But they basically want a binary RPM file to function like an un-tar so the end user just has to double click the RPM file and BOOM all our software is in the proper place.
Example directory structure
/local/Tools/lib
/local/Tools/bin
/local/Tools/scripts
/local/Tools/resources
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Just to clarify, the .tar.gz file I get DOES NOT contain source. It is the result of the source already having been compiled. I just need an RPM that can be clicked on and extract or copy files to a specific directory. Much like you would do with the original .tar.gz file anyway.
ASKER
Thank you kosarajudeepak. I will try that and report back.
ruggar, we understand the structure of your tarball. Like I mentioned above, you can just have the RPM extract the files when double-clicked and exit.
RPM nature is to extract and push to specific location - like if u see the package below my package just pushes the files to specific location.
So when I install (or) double click this RPM the files are copied to the location define inside the rpm pkg.
To make things simple I attached sample spec file which does exactly you might be looking for.
So when I install (or) double click this RPM the files are copied to the location define inside the rpm pkg.
To make things simple I attached sample spec file which does exactly you might be looking for.
[root@pro01 ~]# rpm -qpl nagios-3.0.3-1.fc4.test.i386.rpm
/etc/init.d/nagios
/etc/nagios
/etc/nagios/cgi.cfg
/etc/nagios/contacts.cfg
/etc/nagios/nagios.cfg
/etc/nagios/resource.cfg
/etc/nagios/timeperiods.cfg
/usr/lib/nagios/eventhandlers
/usr/lib/nagios/eventhandlers/disable_active_service_checks
/usr/lib/nagios/eventhandlers/disable_notifications
/usr/lib/nagios/eventhandlers/enable_active_service_checks
/usr/lib/nagios/eventhandlers/enable_notifications
/usr/lib/nagios/eventhandlers/submit_check_result
/usr/sbin/convertcfg
/usr/sbin/mini_epn
/usr/sbin/nagios
/usr/sbin/nagiostats
/usr/sbin/new_mini_epn
/usr/share/doc/nagios-3.0.3
/usr/share/doc/nagios-3.0.3/Changelog
/usr/share/doc/nagios-3.0.3/INSTALLING
/usr/share/doc/nagios-3.0.3/LICENSE
/usr/share/doc/nagios-3.0.3/README
/usr/share/doc/nagios-3.0.3/UPGRADING
/var/log/nagios
/var/log/nagios/archives
/var/spool/nagios
[root@pro01 nsca-2.7.2]# cat nsca.spec
%define name nsca
%define version 2.7.2
%define release 1
# Macro that print mesages to syslog at package (un)install time
%define nnmmsg logger -t %{name}/rpm
Summary: Host/service/network monitoring agent for Nagios
URL: http://www.nagios.org
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Group: Application/System
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-buildroot
%description
This program is designed to accept passive service check results from
clients that use the send_nsca utility and pass them along to the
Nagios process by using the external command
interface.
%setup -q
%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
install -b -D -m 0644 sample-config/nsca.cfg ${RPM_BUILD_ROOT}/etc/nagios/nsca.cfg
install -b -D -m 0644 sample-config/send_nsca.cfg ${RPM_BUILD_ROOT}/etc/nagios/send_nsca.cfg
install -b -D -m 0755 src/nsca ${RPM_BUILD_ROOT}/usr/sbin/nsca
install -b -D -m 0755 src/send_nsca ${RPM_BUILD_ROOT}/usr/bin/send_nsca
%clean
rm -rf $RPM_BUILD_ROOT
%files send
%defattr(755,root,root)
/usr/bin/send_nsca
%defattr(644,root,root)
%config(noreplace) /etc/nagios/send_nsca.cfg
%defattr(755,%{nsusr},%{nsgrp})
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
AbhisekSanyal:
Could you provide me an example of using a tar.gz file with myrpm? When I try to run it I get an error:
I ran this command:
myrpm -v -a /myrpm/testtoolset.tar.gz -N Toolset -V 10 -R 2 -S Toolset -b
I get this error:
Could not create filehandle for '%(echo /home/ruggar)/Toolset10.1/ SOURCES/To olset-10.t ar.gz': No such file or directory! at /usr/bin/myrpm line 456
Which is odd because the directory exists and the file does too. I copied the tar file to there and tried it and still no dice. All the paths are correct. I dunno.
Could you provide me an example of using a tar.gz file with myrpm? When I try to run it I get an error:
I ran this command:
myrpm -v -a /myrpm/testtoolset.tar.gz -N Toolset -V 10 -R 2 -S Toolset -b
I get this error:
Could not create filehandle for '%(echo /home/ruggar)/Toolset10.1/
Which is odd because the directory exists and the file does too. I copied the tar file to there and tried it and still no dice. All the paths are correct. I dunno.
Hi,
I am assuming that you were running this as the user "ruggar".
You will need to create a ".rpmmacros" file for this script to work ( I was unable to locate the howto which said that )
Contents of "/home/ruggar/.rpmmacros" (There is a dot before the file name)
%_topdir /tmp/toolset
%packager Abhisek Sanyal<abhisek.sanyal@gmai l.com>
%vendor My Vendor Name
%vendor_url Website of my Vendor
%distribution Distribution name
%_arch i686
%dist_tag .1
%_tmppath /var/tmp
%_signature gpg
%_gpg_name Abhisek Sanyal
In the above macros file, "/tmp/toolset" is the directory where everything will be present (rpm, srpm, spec file, tar file and the build area).
You need to create the following directories before running the script
/tmp/toolset/SOURCES
/tmp/toolset/SPECS
You can always change "/tmp/toolset" and point it to some where else. You will need to update the ".rpmmacros" file and create the SOURCES and SPECS directory in it.
Now it should work.
I am assuming that you were running this as the user "ruggar".
You will need to create a ".rpmmacros" file for this script to work ( I was unable to locate the howto which said that )
Contents of "/home/ruggar/.rpmmacros" (There is a dot before the file name)
%_topdir /tmp/toolset
%packager Abhisek Sanyal<abhisek.sanyal@gmai
%vendor My Vendor Name
%vendor_url Website of my Vendor
%distribution Distribution name
%_arch i686
%dist_tag .1
%_tmppath /var/tmp
%_signature gpg
%_gpg_name Abhisek Sanyal
In the above macros file, "/tmp/toolset" is the directory where everything will be present (rpm, srpm, spec file, tar file and the build area).
You need to create the following directories before running the script
/tmp/toolset/SOURCES
/tmp/toolset/SPECS
You can always change "/tmp/toolset" and point it to some where else. You will need to update the ".rpmmacros" file and create the SOURCES and SPECS directory in it.
Now it should work.
ASKER
Is there a size limit on RPMs? When I use the myrpm tool I eventually get an "Out of memory!" error. My Toolset is 4 gigabyets large with 35k+ files.
Can you run the script with -v to see the command where it runs out of memory ? That will help narrow down the issue.
ASKER
Multiple solutions accepted for multiple ways to accomplish the goal.
I'd read this as an introduction: http://www.ibm.com/develop
In your case, you can just leave the %build and %install sections blank.