RedHat version in rpm spec files


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat RedHat version in rpm spec files
# 1  
Old 09-28-2012
RedHat version in rpm spec files

Hi

In opensuse we have this nice version control variable I use much when designing rpm spec files:


Code:
rpm --showrc | grep suse_version
%if 0%{?suse_version} > 0 && 0%{?suse_version} < 1700 
-14: suse_version       1140

But I do not find anything close to this in rhel/centos
The only way I've found is to sed /etc/redhat-release

Like this:

Code:
cat /etc/redhat-release | sed 's/[^0-9]//g'
63

But I do not know if this holds for all releases.

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Cybersecurity

Rpm for BIND 9 version 9.9.7-P2 (fix CVE-2015-5477) rhel

Hello, I have a RedHat machine (version 5.11) and i need to install BIND version version 9.9.7-P2 in order to fix a known BIND vulnerability CVE-2015-5477. I downloaded the tar file from isc website but i am having trouble to install the file. Does anybody knows a link for the rpm package of... (0 Replies)
Discussion started by: omonoiatis9
0 Replies

2. Ubuntu

Install and configure ntp rpm on Ubuntu 13.10 version

Hello, I am new to ubuntu Server OS and so trying to setup and ntp service on couple of servers. I see ntp rpm is not installed. # dpkg --get-selections | grep -v deinstall | grep ntp ntpdate install # so I tried to installed ntp rpm using... (5 Replies)
Discussion started by: bobby320
5 Replies

3. Red Hat

Installing PHP tools using RPM in Redhat Linux

Hi there, I am trying to install few PHP tools in my Linux server by creating RPMs from source ( tar.gz) files. The issue here is that the tar.gz files does not have a configure file and so I am not able to do ./configure make install opertations. I tried downloading src.rpms of these tools,... (0 Replies)
Discussion started by: Vicky81
0 Replies

4. Shell Programming and Scripting

build rpm with SPEC file for packaging .jar and some .sh files..

Good day people, Hereby wish to have your advise for below: I have some .jar files, some script files (install.sh, action.sh) , and a libaes.so file. Basically, the .jar files compute the operation of my system and define the working directory for my system. My current scenario: i trigger... (1 Reply)
Discussion started by: cielle
1 Replies

5. Shell Programming and Scripting

Calling script from a RPM spec file

Hi, I want to execute a script "myscript.sh" in the %post part of a rpm spec file. Suppose the script is placed in /opt/path. Then simply calling like sh /opt/path/myscript.sh from %post part (of that spec file) will suffice? Or there is any other way? (0 Replies)
Discussion started by: saurabhkoar
0 Replies

6. UNIX for Dummies Questions & Answers

Question on Redhat ver.6 RPM's

Hi, Using Redhat version 6.0, I need nmap so I have downloaded. But it requires many other dependencies, when I try to install it. See below err.msg. Is there any other way to get this installed, or I need to download each of the dependencies. rpm -Uhv nmap-5.51-2-mdv2011.0.x86_64.rpm... (3 Replies)
Discussion started by: samnyc
3 Replies

7. Shell Programming and Scripting

How to make RPM not write to RPM database if RPM fails to deploy?

How to make RPM not write to RPM database if RPM fails to deploy? IE I create an rpm spec file that contains the following if then exit 1 fi My rpm will fail at deployment, but if I do rpm -qa , I can see the rpm in the rpm db (3 Replies)
Discussion started by: 3junior
3 Replies

8. Shell Programming and Scripting

Need help writing RPM .spec file

I'm new to this. This installer just installs PHP code so NOTHING needs to be built (do I still need to use the build and buildroot directories?). I would just like to create an installer (spec) that: 1) unpacks a tarball 2) moves the unpacked files to the installation target 3) runs a script... (2 Replies)
Discussion started by: stevenswj
2 Replies

9. UNIX for Advanced & Expert Users

Find RedHat version.

How can I find out with a C program, on which RedHat version the program is being ran ? I do know through compilation variables that I'm on RedHat but so far cannot find out which one. Currently the closest I got was to invoke an ls or cat through syscall for the release or motd files. ... (5 Replies)
Discussion started by: amirvosko
5 Replies

10. UNIX for Dummies Questions & Answers

Redhat linux version

Guys How do i know the version of linux (Redhat) on one of our systems..Thanks in advance..The uname -r gives 2.4.18-0.13..Is it the kernel version (3 Replies)
Discussion started by: sssow
3 Replies
Login or Register to Ask a Question
Alien::Package::Rpm(3pm)				User Contributed Perl Documentation				  Alien::Package::Rpm(3pm)

NAME
Alien::Package::Rpm - an object that represents a rpm package DESCRIPTION
This is an object class that represents a rpm package. It is derived from Alien::Package. FIELDS
prefixes Relocatable rpm packages have a prefixes field. METHODS
checkfile Detect rpm files by their extention. install Install a rpm. If RPMINSTALLOPT is set in the environement, the options in it are passed to rpm on its command line. scan Implement the scan method to read a rpm file. unpack Implement the unpack method to unpack a rpm file. This is a little nasty because it has to handle relocatable rpms and has to do a bit of permissions fixing as well. prep Prepare for package building by generating the spec file. cleantree Delete the spec file. build Build a rpm. If RPMBUILDOPT is set in the environement, the options in it are passed to rpm on its command line. An optional parameter, if passed, can be used to specify the program to use to build the rpm. It defaults to rpmbuild. version Set/get version. When retreiving the version, remove any dashes in it. postinst postrm preinst prerm Set/get script fields. When retrieving a value, we have to do some truely sick mangling. Since debian/slackware scripts can be anything -- perl programs or binary files -- and rpm is limited to only shell scripts, we need to encode the files and add a scrap of shell script to make it unextract and run on the fly. When setting a value, we do some mangling too. Rpm maintainer scripts are typically shell scripts, but often lack the leading shebang line. This can confuse dpkg, so add the shebang if it looks like there is no shebang magic already in place. Additionally, it's not uncommon for rpm maintainer scripts to contain bashisms, which can be triggered when they are ran on systems where /bin/sh is not bash. To work around this, the shebang line of the scripts is changed to use bash. Also, if the rpm is relocatable, the script could refer to RPM_INSTALL_PREFIX, which is set by rpm at run time. Deal with this by adding code to the script to set RPM_INSTALL_PREFIX. arch Set/get arch field. When the arch field is set, some sanitizing is done first to convert it to the debian format used internally. When it's retreived it's converted back to rpm form from the internal form. AUTHOR
Joey Hess <joey@kitenet.net> perl v5.14.2 2011-08-05 Alien::Package::Rpm(3pm)