File hp-drive-guard.spec of Package hp-drive-guard

# spec file for package hp-drive-guard
# Copyright (c) 2012 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

%define new_polkit	(%suse_version >= 1140)
%define use_upower	(%suse_version > 1120)
%define use_gtk3	(%suse_version > 1140)
%define with_systemd	(%suse_version > 1140)

%if %{new_polkit}
%define polkitdir	%{_datadir}/polkit-1/actions
%define polkitdir	%{_datadir}/PolicyKit/policy

Name:           hp-drive-guard
BuildRequires:  fdupes
BuildRequires:  gnome-common
BuildRequires:  intltool
%if %{use_gtk3}
BuildRequires:  gtk3-devel
BuildRequires:  gtk2-devel
BuildRequires:  dbus-1-glib-devel
BuildRequires:  libnotify-devel
BuildRequires:  libxslt
%if %{new_polkit}
BuildRequires:  polkit-devel
BuildRequires:  PolicyKit-gnome-devel
%if %{use_upower}
BuildRequires:  libupower-glib-devel
BuildRequires:  hal-devel
# BuildRequires:  scrollkeeper
BuildRequires:  update-desktop-files
%if %{with_systemd}
BuildRequires:  pkgconfig(systemd)
Version:        0.3.12
Release:        0
Summary:        HP DriveGuard for SuSE
License:        GPL-2.0+
Group:          Hardware/Mobile
Source:         hp-drive-guard-%{version}.tar.bz2
Source1:        hp-drive-guard.service
Patch1:         0001-Fix-misc-compile-warnings.patch
Patch2:         0002-Fix-build-with-the-new-libnotify.patch
Patch3:         use-new-polkit.diff
Patch4:         use-gtk3.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

HP DriveGuard for SuSE. Can protect hard disks on HP laptops by
spinning them down when shaking or free-fall is detected.

    Hans Petter Jansson <>

%setup -q
%patch1 -p1
%patch2 -p1
%if %{new_polkit}
%patch3 -p1
%if %{use_gtk3}
%patch4 -p1

%if %use_upower
%define pm_method	upower
%define pm_method	hal

%if %suse_version >= 1120
%define user_setup	--enable-user-setup
# HP requested to prohibit changing parameters in setup dialog for SLED
%define user_setup	--disable-user-setup

autoreconf -f -i
%configure --with-pm=%{pm_method} %user_setup \
	--disable-schemas-install \
%__make %{?jobs:-j%jobs}

%if %with_systemd
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
install -c -m 0644 %{S:1} $RPM_BUILD_ROOT%{_unitdir}/hp-drive-guard.spec
%find_lang %{name}


%if %{with_systemd}
%service_add_pre hp-drive-guard.service
exit 0

%{fillup_and_insserv -n hp-drive-guard}
%if %{with_systemd}
%service_add_post hp-drive-guard.service
exit 0

%{stop_on_removal hp-drive-guard}
%if %{with_systemd}
%service_del_preun hp-drive-guard.service
exit 0

%{restart_on_update hp-drive-guard}
%if %{with_systemd}
%service_del_postun hp-drive-guard.service
exit 0

%files -f %{name}.lang
%config(noreplace) /etc/*.conf
%if %{with_systemd}

openSUSE Build Service is sponsored by