File hddtemp.spec of Package hddtemp

#
# spec file for package hddtemp
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2002-2012 Manfred Tremmel <Manfred.Tremmel@iiv.de>
#
# 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/
#


#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
  %define _fillupdir /var/adm/fillup-templates
%endif

Name:           hddtemp
Version:        0.4.x
Release:        0
Summary:        Hard disk temperature tool
License:        GPL-2.0+
Group:          System/Monitoring
Summary(de):    Festplatten Temperatur-Ausleseprogramm
Url:            https://github.com/vitlav/hddtemp
Source0:        %{name}-%{version}.tar.xz
Source1:        %{name}.db
Source2:        %{name}.sysconfig
Source3:        %{name}.service
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gawk
BuildRequires:  gcc
BuildRequires:  gettext
BuildRequires:  net-tools
BuildRequires:  perl
BuildRequires:  syslogd
BuildRequires:  dos2unix
BuildRequires:  gettext-tools
BuildRequires:  pkgconfig(systemd)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
hddtemp is tool that gives you the temperature of your hard drive by
reading S.M.A.R.T. information.

%description -l de
htddtemp ist ein Tool zum auslesen der Festplattentemperatur aus den
S.M.A.R.T Informationenen.

%prep
%autosetup -p1 -n %{name}-%{version}

chmod -x contribs/analyze/*
dos2unix po/*
rm COPYING
cp -p GPL-2 COPYING

gettextize -f
autoreconf -vif

%build
%configure \
  --disable-dependency-tracking \
  --prefix=/usr \
  --with-db-path=%{_sysconfdir}/hddtemp.db
  
export CFLAGS="%{optflags} -D_GNU_SOURCE"
%make_build

%install
%make_install
mkdir -p %{buildroot}%{_sysconfdir}/default
mkdir -p %{buildroot}%{_fillupdir}
mkdir -p %{buildroot}%{_unitdir}
install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}
install -m 0644 %{SOURCE2} %{buildroot}%{_fillupdir}/sysconfig.%{name}
install -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}

%find_lang %{name}

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun %{name}.service

%pre
%service_add_pre %{name}.service

%post
%{fillup_only %{name}}
%service_add_post %{name}.service

%files -f %{name}.lang
%defattr(-,root,root)
%doc COPYING README TODO contribs
%{_fillupdir}/sysconfig.%{name}
%config(noreplace) %{_sysconfdir}/hddtemp.db
%doc %{_mandir}/man8/hddtemp.8*
%attr(0755,root,root) %{_sbindir}/%{name}
%{_unitdir}/%{name}.service

%changelog
openSUSE Build Service is sponsored by