2 # Copyright 1999-2014 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License, v2
10 # An empty DISKLIST is allowed because the disk will be
12 for DISK in ${DISKLIST}; do
13 if [ ! -b /dev/${DISK} ]; then
14 eerror "Could not find disk /dev/${DISK}!"
15 eerror "Adjust the DISK setting in /etc/conf.d/hdapsd"
19 if [ ! -e /sys/block/${DISK}/queue/protect ] && \
20 [ ! -e /sys/block/${DISK}/device/unload_heads ] ; then
21 eerror "No protect entry for ${DISK}!"
22 eerror "Make sure your kernel is patched with the blk_freeze patch"
27 # Load the tp_smapi module first. This is not a requirement, but
28 # it helps hdapsd's adaptive mode.
29 if [ ! -e /sys/devices/platform/smapi ] ; then
30 modprobe tp_smapi 2>/dev/null
33 if [ ! -d /sys/devices/platform/hdaps ] ; then
34 ebegin "Loading hdaps module"
41 checkconfig || return 1
44 for DISK in ${DISKLIST}; do
45 DISKOPTS="${DISKOPTS} -d ${DISK}"
48 # Since we're allowed to have an empty $THRESHOLD, we append
49 # "--sensitivity $THRESHOLD" to $OPTIONS here only when it exists.
50 if [ ! -z "${THRESHOLD}" ] ; then
51 OPTIONS="${OPTIONS} --sensitivity ${THRESHOLD}"
54 ebegin "Starting Hard Drive Active Protection System daemon"
55 start-stop-daemon --start --exec /usr/sbin/hdapsd \
56 --pidfile /var/run/hdapsd.pid \
57 -- --syslog --background --pidfile \
58 ${DISKOPTS} ${OPTIONS}
63 ebegin "Stopping Hard Drive Active Protection System daemon"
64 start-stop-daemon --stop --exec /usr/sbin/hdapsd \
65 --pidfile /var/run/hdapsd.pid