File hd-idle.spec of Package hd-idle

# spec file for package hd-idle
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2014 B1 Systems GmbH, Vohburg, 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

Name:           hd-idle
Version:        1.05
Release:        0
Summary:        Spin down external harddisks
License:        GPL-2.0+
Group:          System/Base
Source:         hd-idle-%{version}.tgz
Source2:        hd-idle.default
Source3:        hd-idle.service
Patch1:         hd-idle-systemd-nodaemon.diff
BuildRequires:  sed
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

hd-idle is a utility program for spinning-down external disks after a period of idle time. Since most external IDE disk enclosures don't support setting the IDE idle timer, a program like hd-idle is required to spin down idle disks automatically.

%setup -q -n %{name}
%patch1 -p1

# don't chown the files
sed -i -e 's/-g root -o root //' Makefile

make %{?_smp_mflags} CFLAGS="%{optflags}"

chmod 0644 %{buildroot}%{_mandir}/man1/*

install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/default/hd-idle
install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/hd-idle.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rchd-idle

%service_add_pre hd-idle.service

%service_del_preun hd-idle.service

%service_add_post hd-idle.service

%service_del_postun hd-idle.service

%doc README debian/changelog
%config(noreplace) %{_sysconfdir}/default/hd-idle