Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > ea12144ac2c28015e5ba5b87834a6d5c > files > 1

SL_rpm_show_arch-1.1-1.src.rpm

%define targetfile /usr/lib/rpm/macros

Summary: Set it so that general rpm queries show the rpm's arch
Name: SL_rpm_show_arch
Version: 1.1
Release: 1
License: GPL
Group: SL
URL: https://www.scientificlinux.org/
Packager: Troy Dawson
Requires: rpm
BuildArch: noarch

%description
By default, rpm queries do not show what arch a particular rpm is.
This can cause confusion when it is important, such as in the x86_64
based distributions.
This rpm makes it so that you will see the arch when doing queries.

%files
%post
#
# This modifies /usr/lib/rpm/macros to add the arch to queries
#
if [ -f %{targetfile} ] ; then
	if ! `grep -q %%%%{name}-%%%%{version}-%%%%{release}.%%%%{arch} %{targetfile}` ; then
		sed -i -e "s:%%%%{name}-%%%%{version}-%%%%{release}.%%%%{arch}:%%%%{name}-%%%%{version}-%%%%{release}:"  %{targetfile}
	fi
fi

%postun
if [ "$1" = "0" ] ; then
	#
	# This modifies /usr/lib/rpm/macros to add the arch to queries
	#
	if [ -f %{targetfile} ] ; then
		sed -i -e "s:%%%%{name}-%%%%{version}-%%%%{release}.%%%%{arch}:%%%%{name}-%%%%{version}-%%%%{release}:"  %{targetfile}
	fi
fi

%triggerin -- rpm
if [ -f %{targetfile} ] ; then
	if ! `grep -q %%%%{name}-%%%%{version}-%%%%{release}.%%%%{arch} %{targetfile}` ; then
		cat %{targetfile} | sed -e "s:%%%%{name}-%%%%{version}-%%%%{release}:%%%%{name}-%%%%{version}-%%%%{release}.%%%%{arch}:"  > %{targetfile}.tmp
		cat %{targetfile}.tmp > %{targetfile}
		rm %{targetfile}.tmp
	fi
fi

%changelog
* Fri Jun 13 2008 Troy Dawson <dawson@fnal.gov> - 1.1-1
- Changed the way /usr/lib/rpm/macros is edited to make it umask friendly
  Patch for the change was submitted by Dr. Andrew C. Aitchison