Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42af4b490a | ||
|
|
b46946c04d | ||
|
|
54a418e05b | ||
|
|
aff8fa106d |
10 changed files with 211 additions and 1 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
hdapsd-20090401.tar.gz
|
||||
1
99-hdapsd.rules.systemd
Normal file
1
99-hdapsd.rules.systemd
Normal file
|
|
@ -0,0 +1 @@
|
|||
SUBSYSTEM=="block", KERNEL=="sd[ab]", ATTRS{removable}=="0", TAG="systemd", ENV{SYSTEMD_WANTS}="hdapsd@%k.service"
|
||||
|
|
@ -1 +0,0 @@
|
|||
Orphaned for 6+ weeks
|
||||
13
hdapsd.event
Normal file
13
hdapsd.event
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# hdapsd starting script
|
||||
# laptops seldom have >2 HDD, so we care only about first two
|
||||
|
||||
start on block-device-added sd[ab]
|
||||
instance
|
||||
nice -5
|
||||
|
||||
script
|
||||
. /etc/sysconfig/hdapsd
|
||||
|
||||
/usr/sbin/hdapsd -b -l -d $1 $HDAPSD_OPTIONS
|
||||
end script
|
||||
|
||||
14
hdapsd.event.upstart0.6
Normal file
14
hdapsd.event.upstart0.6
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# hdapsd starting script
|
||||
# laptops seldom have >2 HDD, so we care only about first two
|
||||
|
||||
start on device-added SUBSYSTEM=block DEVNAME=sd[ab]
|
||||
instance $1
|
||||
expect fork
|
||||
nice -5
|
||||
|
||||
script
|
||||
. /etc/sysconfig/hdapsd
|
||||
|
||||
/usr/sbin/hdapsd -b -l -d $1 $HDAPSD_OPTIONS
|
||||
end script
|
||||
|
||||
111
hdapsd.spec
Normal file
111
hdapsd.spec
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
Name: hdapsd
|
||||
Version: 20090401
|
||||
Release: 6%{?dist}.2
|
||||
Summary: Protects hard drives by parking head when fall is detected
|
||||
|
||||
Group: Applications/System
|
||||
License: GPLv2+
|
||||
URL: http://hdaps.sourceforge.net/
|
||||
Source0: http://downloads.sourceforge.net/hdaps/hdapsd-%{version}.tar.gz
|
||||
Source1: hdapsd.event.upstart0.6
|
||||
Source2: hdapsd.sysconfig
|
||||
Source3: 99-hdapsd.rules.systemd
|
||||
Source4: hdapsd@.service
|
||||
Source5: hdapsd.sysvinit
|
||||
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||
Requires: systemd-units
|
||||
Requires(post): chkconfig
|
||||
Requires(preun): chkconfig
|
||||
# This is for /sbin/service
|
||||
Requires(preun): initscripts
|
||||
|
||||
%description
|
||||
|
||||
This is a disk protection user-space daemon. It monitors the acceleration
|
||||
values through the HDAPS/AMS interfaces and automatically initiates disk head
|
||||
parking if a fall or sliding of the laptop is detected.
|
||||
|
||||
HDAPS is typically found in ThinkPad laptops and AMS in Apple laptops.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%configure
|
||||
make %{?_smp_mflags}
|
||||
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
make install DESTDIR=%{buildroot}
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/init/
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig/
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/udev/rules.d/
|
||||
mkdir -p %{buildroot}/lib/systemd/system/
|
||||
mkdir -p %{buildroot}%{_initddir}
|
||||
cp -p %SOURCE1 %{buildroot}%{_sysconfdir}/init/hdapsd.conf
|
||||
cp -p %SOURCE2 %{buildroot}%{_sysconfdir}/sysconfig/hdapsd
|
||||
cp -p %SOURCE3 %{buildroot}%{_sysconfdir}/udev/rules.d/99-hdapsd.rules
|
||||
cp -p %SOURCE4 %{buildroot}/lib/systemd/system/
|
||||
cp -p %SOURCE5 %{buildroot}%{_initddir}/hdapsd
|
||||
# remove docs installed by "make install", will be installed in proper dir by %doc
|
||||
rm -rf %{buildroot}%{_defaultdocdir}/%{name}
|
||||
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%post
|
||||
# This adds the proper /etc/rc*.d links for the script
|
||||
/sbin/chkconfig --add hdapsd
|
||||
|
||||
%preun
|
||||
if [ $1 = 0 ] ; then
|
||||
/sbin/service hdapsd stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del hdapsd
|
||||
fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{_sbindir}/*
|
||||
%config(noreplace) %{_sysconfdir}/udev/rules.d/99-hdapsd.rules
|
||||
%config(noreplace) %{_sysconfdir}/init/hdapsd.conf
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/hdapsd
|
||||
/lib/systemd/system/hdapsd@.service
|
||||
%{_mandir}/man8/hdapsd.8.gz
|
||||
%{_initddir}/hdapsd
|
||||
%doc AUTHORS
|
||||
%doc COPYING
|
||||
%doc ChangeLog
|
||||
%doc README
|
||||
|
||||
|
||||
%changelog
|
||||
* Sun Jan 9 2011 Tomasz Torcz <ttorcz@fedoraproject.org> 20090401-6.fc14.2
|
||||
- remove bad parentheses in ExecStart= line of systemd unit def
|
||||
(thanks Alexandre Silva Lopes, #667073)
|
||||
|
||||
* Wed Dec 15 2010 Tomasz Torcz <ttorcz@fedoraproject.org> 20090401-6.fc14.1
|
||||
- give up fighting with upstart rules and ship legacy
|
||||
Sysv init script provided by Matthias Haase;
|
||||
(i can haz systemd, where this activation works reliably?)
|
||||
|
||||
* Sat Jul 17 2010 Tomasz Torcz <ttorcz@fedoraproject.org> 20090401-6
|
||||
- provide systemd service definition
|
||||
- resurrect udev rule for systemd interaction
|
||||
|
||||
* Mon Dec 07 2009 Tomasz Torcz <ttorcz@fedoraproject.org> 20090401-5
|
||||
- port initscript file to upstart 0.6, removing custom udev rule
|
||||
|
||||
* Fri Sep 04 2009 Tomasz Torcz <ttorcz@fedoraproject.org> 20090401-4
|
||||
- use version macro in in Source0, as per review suggestion (#505928 #9)
|
||||
|
||||
* Tue Jun 21 2009 Tomasz Torcz <ttorcz@fedoraproject.org> 20090401-3
|
||||
- fixes from review: URL source, proper build root macro
|
||||
- minor cleanup of event file
|
||||
|
||||
* Sun Jun 17 2009 Tomasz Torcz <ttorcz@fedoraproject.org> 20090401-2
|
||||
- mark upstart event file and udev rule as config files
|
||||
|
||||
* Sun Jun 14 2009 Tomasz Torcz <ttorcz@fedoraproject.org> 20090401-1
|
||||
- initial version
|
||||
2
hdapsd.sysconfig
Normal file
2
hdapsd.sysconfig
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# default sensivity is 15; bump it a little and enable adaptive tuning
|
||||
HDAPSD_OPTIONS="-s 22 -a"
|
||||
59
hdapsd.sysvinit
Executable file
59
hdapsd.sysvinit
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# hdapsd - disk protection user-space daemon
|
||||
#
|
||||
# chkconfig: - 11 91
|
||||
# description: disk protection user-space daemon
|
||||
#
|
||||
# executable: /usr/sbin/hdapsd
|
||||
|
||||
# Source function library
|
||||
. /etc/init.d/functions
|
||||
|
||||
[ -x /usr/sbin/hdapsd ] || exit 1
|
||||
|
||||
[ -e /etc/sysconfig/hdapsd ] && . /etc/sysconfig/hdapsd
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start(){
|
||||
echo -n $"Starting hdaps daemon: "
|
||||
daemon -5 /usr/sbin/hdapsd -f -l -d sda $HDAPSD_OPTIONS
|
||||
RETVAL=$?
|
||||
echo
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop(){
|
||||
echo -n $"Stopping hdaps daemon: "
|
||||
killproc hdapsd
|
||||
RETVAL=$?
|
||||
echo
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
restart(){
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
;;
|
||||
status)
|
||||
status hdapsd
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|status}"
|
||||
RETVAL=1
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
9
hdapsd@.service
Normal file
9
hdapsd@.service
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=%I shock protection daemon
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/etc/sysconfig/hdapsd
|
||||
StandardOutput=syslog
|
||||
SyslogIdentifier=%p(%I)
|
||||
Nice=-5
|
||||
ExecStart=/usr/sbin/hdapsd -d %I $HDAPSD_OPTIONS
|
||||
1
sources
Normal file
1
sources
Normal file
|
|
@ -0,0 +1 @@
|
|||
897cee8b0192febd127470f3e9506aeb hdapsd-20090401.tar.gz
|
||||
Reference in a new issue