File novell-zenworks-facter.spec of Package novell-zenworks-facter

%global realversion 2.5.1
%global rpmversion 2.5.1

%global debug_package %{nil}

Summary:        Ruby module for collecting simple facts about a host operating system
Name:           facter
Version:        %{rpmversion}
Release:        1
#Epoch:          1
Vendor:         %{?_host_vendor}
License:        ASL 2.0
Group:          System Environment/Base
URL:            http://www.puppetlabs.com/puppet/related-projects/%{name}
# Note this     URL will only be valid at official tags from Puppet Labs
Source0:        http://puppetlabs.com/downloads/%{name}/%{name}-%{realversion}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  novell-zenworks-ruby >= 1.8.5


%description
Ruby module for collecting simple facts about a host Operating
system. Some of the facts are preconfigured, such as the hostname and the
operating system. Additional facts can be added through simple Ruby scripts

%package -n novell-zenworks-facter
Summary:        Ruby module for collecting simple facts about a host operating system
Group:          System Environment/Base
Requires:       novell-zenworks-ruby >= 2.0
Requires:       which
# dmidecode and pciutils are not available on all arches
%ifarch %ix86 x86_64 ia64
Requires:       dmidecode
Requires:       pciutils
%endif
Requires:       virt-what

%description -n novell-zenworks-facter
Ruby module for collecting simple facts about a host Operating
system. Some of the facts are preconfigured, such as the hostname and the
operating system. Additional facts can be added through simple Ruby scripts

%define _prefix /opt/novell/zenworks
%define _libdir /opt/novell/zenworks/%{_lib}
%define _bindir /opt/novell/zenworks/bin
%define _docdir /opt/novell/zenworks/share/doc/packages
%if 0%{?suse_version} >= 1500
%define facter_libdir %(LD_LIBRARY_PATH=/opt/novell/zenworks/lib64:$LD_LIBRARY_PATH /opt/novell/zenworks/bin/ruby -rrbconfig -e 'puts RbConfig::CONFIG["rubylibdir"]')
%else
%define facter_libdir %{_prefix}/share/ruby
%endif

%prep
export PATH=/opt/novell/zenworks/bin:$PATH
%setup -q  -n %{name}-%{realversion}

%build


sed -i -e 's@^#!.*$@#! /opt/novell/zenworks/bin/ruby@' bin/facter

%install
export PATH=/opt/novell/zenworks/bin:$PATH
export LD_LIBRARY_PATH=/opt/novell/zenworks/lib64:$LD_LIBRARY_PATH
rm -rf %{buildroot}
ruby install.rb --destdir=%{buildroot} --quick --sitelibdir=%{facter_libdir}
mkdir -p %{buildroot}/opt/novell/zenworks/share/doc/packages

%clean
rm -rf %{buildroot}

%files

%files -n novell-zenworks-facter
%defattr(-,root,root,-)
%dir /opt/novell/zenworks/share/doc/packages
%{_bindir}/facter
%{facter_libdir}/facter.rb
%{facter_libdir}/facter
%doc LICENSE README.md
/opt/novell/zenworks/share/man/*