[packages/hd-idle] new
atler
atler at pld-linux.org
Fri Nov 13 01:06:11 CET 2020
commit 7369f742d343bb4d494a6efca60d7e842e549769
Author: Jan Palus <atler at pld-linux.org>
Date: Fri Nov 13 01:03:38 2020 +0100
new
hd-idle.logrotate | 6 +++++
hd-idle.service | 11 ++++++++
hd-idle.spec | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 98 insertions(+)
---
diff --git a/hd-idle.spec b/hd-idle.spec
new file mode 100644
index 0000000..e7a2182
--- /dev/null
+++ b/hd-idle.spec
@@ -0,0 +1,81 @@
+Summary: Spin down idle [USB] hard disks
+Name: hd-idle
+Version: 1.05
+Release: 1
+License: GPL v2
+Group: Applications/System
+Source0: http://downloads.sourceforge.net/hd-idle/%{name}-%{version}.tgz
+# Source0-md5: 5fa72fe717bc80011a79d6740d2903f3
+Source1: %{name}.service
+Source2: %{name}.logrotate
+URL: http://hd-idle.sourceforge.net
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+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.
+
+A word of caution: hard disks don't like spinning up too often. Laptop
+disks are more robust in this respect than desktop disks but if you
+set your disks to spin down after a few seconds you may damage the
+disk over time due to the stress the spin-up causes on the spindle
+motor and bearings. It seems that manufacturers recommend a minimum
+idle time of 3-5 minutes, the default in hd-idle is 10 minutes.
+
+One more word of caution: hd-idle will spin down any disk accessible
+via the SCSI layer (USB, IEEE1394, ...) but it will not work with real
+SCSI disks because they don't spin up automatically. Thus it's not
+called scsi-idle and I don't recommend using it on a real SCSI system
+unless you have a kernel patch that automatically starts the SCSI
+disks after receiving a sense buffer indicating the disk has been
+stopped. Without such a patch, real SCSI disks won't start again and
+you can as well pull the plug.
+
+%prep
+%setup -q -n %{name}
+%{__sed} -i 's/install -D -g root -o root/install -D/' Makefile
+
+%build
+%{__make} \
+ CC="%{__cc}" \
+ CFLAGS="%{rpmcppflags} %{rpmcflags}" \
+ LDFLAGS="%{rpmldflags}"
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__make} install \
+ DESTDIR=$RPM_BUILD_ROOT
+
+install -d $RPM_BUILD_ROOT%{systemdunitdir}
+install -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
+echo 'HD_IDLE_OPTS="-i 1200 -l %{_localstatedir}/log/hd-idle/hd-idle.log"' > \
+ $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
+install -d $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
+install -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+%systemd_post %{name}.service
+
+%preun
+%systemd_preun %{name}.service
+
+%postun
+%systemd_reload
+
+%files
+%defattr(644,root,root,755)
+%doc README
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_sbindir}/%{name}
+%{_mandir}/man1/%{name}.1*
+%{systemdunitdir}/%{name}.service
+%config(noreplace) /etc/logrotate.d/%{name}
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+%dir %{_localstatedir}/log/%{name}
diff --git a/hd-idle.logrotate b/hd-idle.logrotate
new file mode 100644
index 0000000..a6efe14
--- /dev/null
+++ b/hd-idle.logrotate
@@ -0,0 +1,6 @@
+/var/log/hd-idle/*log {
+ missingok
+ notifempty
+ compress
+ delaycompress
+}
diff --git a/hd-idle.service b/hd-idle.service
new file mode 100644
index 0000000..1b252b4
--- /dev/null
+++ b/hd-idle.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=hd-idle - spin down idle hard disks
+Documentation=man:hd-idle(1)
+
+[Service]
+Type=forking
+EnvironmentFile=-/etc/sysconfig/hd-idle
+ExecStart=/usr/sbin/hd-idle $HD_IDLE_OPTS
+
+[Install]
+WantedBy=multi-user.target
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/hd-idle.git/commitdiff/7369f742d343bb4d494a6efca60d7e842e549769
More information about the pld-cvs-commit
mailing list