File smolt.spec of Package smolt

#
# spec file for package smolt
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#



Name:           smolt
Version:        1.4.3
Release:        3
License:        GPL-3.0+
Summary:        Hardware Profiler
Url:            https://fedorahosted.org/smolt/
Group:          Hardware/Other
Source0:        %{name}-%{version}.tar.bz2
Source1:        smolt.init
Source2:        smolt-icon-64.png
Source3:        smolt-icon-128.png
Source4:        smolt-icon-256.png
Patch1:         smolt-1.1.1.1-desktop_file.patch
Patch2:         smolt-1.4.2.2-make_install.patch
Patch3:         smolt-pci_ids-path.patch
#Patch upstream for FSF address
Patch4:         GPL-patch.diff
#Patch for all kernel 3x bnc#714543
Patch5:         smolt-read_memory-kernel3-patch.patch
BuildRequires:  fdupes
BuildRequires:  gettext
BuildRequires:  python-devel
BuildRequires:  update-desktop-files
PreReq:         /bin/cat
PreReq:         coreutils
Requires:       cron
Requires:       dbus-1-python
Requires:       python-simplejson
Requires:       python-urlgrabber
Requires(pre):  pwdutils
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
The smolt hardware profiler is a server-client system that does a
hardware scan against a machine and sends the results to a public
Fedora Project turbogears server. The sends are anonymous and should
not contain any private information other than the physical hardware
information and basic OS info.

This package contains the smolt client

%package -n smolt-gui
License:        GPL-3.0+
Summary:        Smolt GUI
Group:          Hardware/Other
Requires:       %{name} = %{version}
Requires:       python-qt4
Supplements:    packageand(python-qt4:smolt)

%description -n smolt-gui
The smolt hardware profiler is a server-client system that does a
hardware scan against a machine and sends the results to a public
Fedora Project turbogears server. The sends are anonymous and should
not contain any private information other than the physical hardware
information and basic OS info.

This package contains the smolt client gui

%prep
%setup -q
%patch1
%patch2
%patch3 -p1
%patch4 
%patch5 
cp %{SOURCE1} .

%build
cd client/
%__make %{?_smp_flags}

%install
pushd client
%make_install
install -D -m 755 %{SOURCE1} %{buildroot}/%{_initddir}/smolt
ln -s %{_initddir}/smolt %{buildroot}/%{_bindir}/rcsmolt
touch %{buildroot}/%{_sysconfdir}/smolt/hw-uuid
rm -rf %{buildroot}%{_datadir}/locale/sr@latin %{buildroot}%{_datadir}/locale/default
rm -rf %{buildroot}%{_datadir}/smolt/client/smoltFirstBoot.py
rm -rf %{buildroot}%{_datadir}/smolt/doc/PrivacyPolicy
rm -f %{buildroot}%{_datadir}/smolt/doc/INSTALL
popd

#install icons of additional sizes (bnc# 713902)
install -D -m 644 %{SOURCE2} %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/smolt.png
install -D -m 644 %{SOURCE3} %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/smolt.png
install -D -m 644 %{SOURCE4} %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/smolt.png

%suse_update_desktop_file -G "Desktop Profiler" %{name}
%find_lang %{name}
mkdir -p %{buildroot}%{_localstatedir}/run
touch %{buildroot}%{_localstatedir}/run/smolt_do_opensuse_run

#compile python bytecode (bnc#680123)
%py_compile %{buildroot}%{_datadir}/%{name}/client
%py_compile -O %{buildroot}%{_datadir}/%{name}/client

%fdupes %{buildroot}%{_datadir}

%clean
rm -rf %{buildroot}

%pre
if [ -f %{_sysconfdir}/smolt/uuid -a ! -f %{_sysconfdir}/smolt/hw-uuid ]
then
    /bin/mv %{_sysconfdir}/smolt/uuid %{_sysconfdir}/smolt/hw-uuid
    /bin/chmod 0644 %{_sysconfdir}/smolt/hw-uuid
    /bin/chown root:root %{_sysconfdir}/smolt/hw-uuid
fi

groupadd -r %{name} &>/dev/null || :
useradd  -r -s /sbin/nologin -d %{_datadir}/%{name} \
                               -c 'user for smolt' -g %{name} %{name} &>/dev/null || :

%post
if ! [ -f %{_sysconfdir}/smolt/hw-uuid ]
then
    /bin/cat /proc/sys/kernel/random/uuid > %{_sysconfdir}/smolt/hw-uuid
    /bin/chmod 0644 %{_sysconfdir}/smolt/hw-uuid
    /bin/chown root:root %{_sysconfdir}/smolt/hw-uuid
fi

%preun
%stop_on_removal smolt

%postun
%restart_on_update
%insserv_cleanup

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc README GPL doc/*
%dir %{_sysconfdir}/smolt
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/client
%ghost %{_sysconfdir}/smolt/hw-uuid
%config(noreplace)%{_sysconfdir}/smolt/config.py
%{_bindir}/rcsmolt
%{_bindir}/smoltDeleteProfile
%{_bindir}/smoltSendProfile
%config %{_sysconfdir}/cron.d/%{name}
%{_initddir}/%{name}
%{_datadir}/%{name}/client/__init__.py*
%{_datadir}/%{name}/client/config.py*
%{_datadir}/%{name}/client/deleteProfile.py*
%{_datadir}/%{name}/client/fs_util.py*
%{_datadir}/%{name}/client/gate.py*
%{_datadir}/%{name}/client/i18n.py*
%{_datadir}/%{name}/client/os_detect.py*
%{_datadir}/%{name}/client/scan.py*
%{_datadir}/%{name}/client/sendProfile.py*
%{_datadir}/%{name}/client/smolt.py*
%{_datadir}/%{name}/client/smolt_config.py*
%{_datadir}/%{name}/client/software.py*
%{_datadir}/%{name}/client/uuiddb.py*
%{_datadir}/%{name}/client/MultipartPostHandler.py*
%{_datadir}/%{name}/client/smolt_mythtv.py*
%{_datadir}/%{name}/client/devicelist.py*
%{_datadir}/%{name}/client/hwdata.py*
%{_datadir}/sugar
%{_datadir}/%{name}/client/distros
%{_mandir}/man1/smoltDeleteProfile.1.gz
%{_mandir}/man1/smoltSendProfile.1.gz
%ghost %{_localstatedir}/run/smolt_do_opensuse_run

%files -n smolt-gui
%defattr(-,root,root)
%dir %{_datadir}/%{name}/client/icons
%{_bindir}/smoltGui
%{_datadir}/icons/hicolor
%{_datadir}/applications/smolt.desktop
%{_datadir}/%{name}/client/gui.py*
%{_datadir}/%{name}/client/smoltGui.py*
%{_datadir}/%{name}/client/privacypolicy.py*
%{_datadir}/%{name}/client/icons/*
%{_mandir}/man1/smoltGui.1.gz

%changelog
openSUSE Build Service is sponsored by