File drobo-utils.spec of Package drobo-utils

# sitelib for noarch packages, sitearch for others (remove the unneeded one)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

Name:           drobo-utils
Release:        1
Summary:        Manage data robotics storage units (drobos)

Group:          Applications/System
License:        GPLv3+
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch:      noarch
BuildRequires:  python-devel, desktop-file-utils
Requires:       parted, python-ctypes

 Provides utilities for managing Data Robotics storage units, also known as
 "Drobos".  Drobos are external hard drive enclosures that connect to your PC
 via USB or Firewire and provide RAID-like features.  Drobos provide automatic
 data redundancy, hotswappable drive bays, and the size of the RAID can be
 easily expanded.  Different sized hard drives can be mixed on the same Drobo.
 See for more information.
 This package provides a command line interface for managing a Drobo, as well
 as a graphical dashboard interface.  To enable the graphical interface, please
 be sure to install the suggested python-qt4 package, as well as gparted.

%package gui
Summary:        Manage data robotics storage units (drobos) - GUI utils
Group:          Applications/System

Requires:       gparted, PyQt4, drobo-utils

%description gui
GUI util for drobo-utils

%setup -q

# Remove CFLAGS=... for noarch packages (unneeded)
CFLAGS="%{optflags}" %{__python} build

sed -i -e "s/\#\!\/.*//g"

rm -rf %{buildroot}
%{__python} install -O1 --skip-build --root %{buildroot}

# this is not the right place:
rm -rf  %{buildroot}/usr/share/drobo-utils-doc/
#Menu entry
install -d -m755 %{buildroot}%{_datadir}/applications

cat > %{buildroot}%{_datadir}/applications/%{name}.desktop <<EOF
[Desktop Entry]
Comment=Manage data robotics storage units (drobos)

desktop-file-install  --dir=%{buildroot}%{_datadir}/applications/ %{buildroot}%{_datadir}/applications/%{name}.desktop 

# manpage:
install -d -m755 %{buildroot}%{_mandir}/man8/
install -m 644 drobom.8 %{buildroot}%{_mandir}/man8/
install -m 644 droboview.8 %{buildroot}%{_mandir}/man8/

rm -rf %{buildroot}

%post gui
update-desktop-database %{_datadir}/applications

%postun gui
update-desktop-database %{_datadir}/applications

%doc CHANGES.html DEVELOPERS.html drobom.html  index.html README.html QA.txt COPYING
# For noarch packages: sitelib

%files gui
%doc droboview.html