1 |
mjo 14/10/29 02:12:52 |
2 |
|
3 |
Added: hdapsd.init-20141024 hdapsd.conf-20141024 |
4 |
Log: |
5 |
Add myself as co-maintainer and version bump. |
6 |
|
7 |
(Portage version: 2.2.8-r2/cvs/Linux x86_64, signed Manifest commit with key 0x6F48D3DA05C2DADB!) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 app-laptop/hdapsd/files/hdapsd.init-20141024 |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/hdapsd/files/hdapsd.init-20141024?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/hdapsd/files/hdapsd.init-20141024?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: hdapsd.init-20141024 |
16 |
=================================================================== |
17 |
#!/sbin/runscript |
18 |
# Copyright 1999-2014 Gentoo Foundation |
19 |
# Distributed under the terms of the GNU General Public License, v2 |
20 |
|
21 |
description="Hard Drive Active Protection System daemon" |
22 |
command="/usr/sbin/hdapsd" |
23 |
pidfile="/run/hdapsd.pid" |
24 |
|
25 |
# Always daemonize when started by OpenRC, and don't make the pidfile |
26 |
# configurable. Even if the user sets something dumb for the pidfile |
27 |
# in /etc/hdapsd.conf, we want it to work! Fortunately the settings |
28 |
# passed on the command-line override the config file. |
29 |
command_args="--background --pidfile=${pidfile}" |
30 |
|
31 |
|
32 |
depend() { |
33 |
need localmount |
34 |
} |
35 |
|
36 |
checkconfig() { |
37 |
# An empty DISKLIST is allowed because the disk will be |
38 |
# auto-detected. |
39 |
for DISK in ${DISKLIST}; do |
40 |
if [ ! -b /dev/${DISK} ]; then |
41 |
eerror "Could not find disk /dev/${DISK}!" |
42 |
eerror "Adjust the DISK setting in /etc/conf.d/hdapsd" |
43 |
return 1 |
44 |
fi |
45 |
|
46 |
if [ ! -e /sys/block/${DISK}/queue/protect ] && \ |
47 |
[ ! -e /sys/block/${DISK}/device/unload_heads ] ; then |
48 |
eerror "No protect entry for ${DISK}!" |
49 |
eerror "Make sure your kernel is patched with the blk_freeze patch" |
50 |
return 1 |
51 |
fi |
52 |
done |
53 |
|
54 |
# Load the tp_smapi module first. This is not a requirement, but |
55 |
# it helps hdapsd's adaptive mode. |
56 |
if [ ! -e /sys/devices/platform/smapi ] ; then |
57 |
modprobe tp_smapi 2>/dev/null |
58 |
fi |
59 |
|
60 |
if [ ! -d /sys/devices/platform/hdaps ] ; then |
61 |
ebegin "Loading hdaps module" |
62 |
modprobe hdaps |
63 |
eend $? || return 1 |
64 |
fi |
65 |
} |
66 |
|
67 |
start() { |
68 |
checkconfig || return 1 |
69 |
|
70 |
for DISK in ${DISKLIST}; do |
71 |
command_args="${command_args} -d ${DISK}" |
72 |
done |
73 |
|
74 |
# Since all of these settings are now optional, we append them |
75 |
# only if we need to. |
76 |
if [ ! -z "${THRESHOLD}" ] ; then |
77 |
command_args="${command_args} --sensitivity ${THRESHOLD}" |
78 |
fi |
79 |
|
80 |
if [ ! -z "${SYSLOG}" ] ; then |
81 |
command_args="${command_args} --syslog" |
82 |
fi |
83 |
|
84 |
if [ ! -z "${OPTIONS}" ] ; then |
85 |
command_args="${command_args} ${OPTIONS}" |
86 |
fi |
87 |
|
88 |
ebegin "Starting the ${description}" |
89 |
start-stop-daemon --start --exec "${command}" --pidfile "${pidfile}" \ |
90 |
-- ${command_args} |
91 |
eend $? |
92 |
} |
93 |
|
94 |
|
95 |
|
96 |
1.1 app-laptop/hdapsd/files/hdapsd.conf-20141024 |
97 |
|
98 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/hdapsd/files/hdapsd.conf-20141024?rev=1.1&view=markup |
99 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/hdapsd/files/hdapsd.conf-20141024?rev=1.1&content-type=text/plain |
100 |
|
101 |
Index: hdapsd.conf-20141024 |
102 |
=================================================================== |
103 |
# Configuration for the HDAPS daemon (hdapsd). All settings here are |
104 |
# optional and will override those set in /etc/hdapsd.conf (if hdapsd |
105 |
# was built with libconfig support). |
106 |
|
107 |
# The list of the disk devices that hdapsd should monitor. Usually |
108 |
# this is "hda", "sda", or "hda sda". The hdaps daemon will attempt to |
109 |
# auto-detect your drive if this is left empty. Empty by default. |
110 |
# |
111 |
#DISKLIST="sda" |
112 |
|
113 |
# Hdapsd sensitivity. The lower the threshold, the earlier the heads |
114 |
# are parked when movement is detected. The default is determined by |
115 |
# hdapsd, and is currently 15. |
116 |
# |
117 |
#THRESHOLD="10" |
118 |
|
119 |
# Log to syslog? Disabled by default. |
120 |
# |
121 |
#SYSLOG="true" |
122 |
|
123 |
# Set any extra options here, like -a for "adaptive mode". Empty by |
124 |
# default. |
125 |
# |
126 |
#OPTIONS="-a" |