Gentoo Archives: gentoo-commits

From: "Christoph Junghans (ottxor)" <ottxor@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-laptop/hdapsd/files: hdapsd.init.2 hdapsd.conf.2
Date: Wed, 21 Dec 2011 04:51:34
Message-Id: 20111221045122.F313C2004B@flycatcher.gentoo.org
1 ottxor 11/12/21 04:51:22
2
3 Added: hdapsd.init.2 hdapsd.conf.2
4 Log:
5 fixed bug #334435 and bug #392475
6
7 (Portage version: 2.2.0_alpha81/cvs/Linux i686)
8
9 Revision Changes Path
10 1.1 app-laptop/hdapsd/files/hdapsd.init.2
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/hdapsd/files/hdapsd.init.2?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/hdapsd/files/hdapsd.init.2?rev=1.1&content-type=text/plain
14
15 Index: hdapsd.init.2
16 ===================================================================
17 #!/sbin/runscript
18 # Copyright 1999-2011 Gentoo Foundation
19 # Distributed under the terms of the GNU General Public License, v2
20
21 depend() {
22 need localmount
23 }
24
25 checkconfig() {
26 if [[ -n ${DISK} ]]; then
27 ewarn "Please migrate DISK to DISKLIST in /etc/conf.d/hdapsd."
28 DISKLIST=${DISK}
29 fi
30
31 if [[ -z ${DISKLIST} || -z ${THRESHOLD} ]] ; then
32 eerror "You should setup DISKLIST and THRESHOLD in /etc/conf.d/hdapsd."
33 return 1
34 fi
35
36 for DISK in ${DISKLIST}; do
37 if [ ! -b /dev/${DISK} ]; then
38 eerror "Could not find disk /dev/${DISK}!"
39 eerror "Adjust the DISK setting in /etc/conf.d/hdapsd"
40 return 1
41 fi
42
43 if [[ ! -e /sys/block/${DISK}/queue/protect ]] && [[ ! -e /sys/block/${DISK}/device/unload_heads ]] ; then
44 eerror "No protect entry for ${DISK}!"
45 eerror "Make sure your kernel is patched with the blk_freeze patch"
46 return 1
47 fi
48 done
49
50 # Load the tp_smapi module first
51 # This is not a requirement, but it helps hdapsd adaptive mode
52 if [[ ! -e /sys/devices/platform/smapi ]] ; then
53 modprobe tp_smapi 2>/dev/null
54 fi
55
56 if [[ ! -d /sys/devices/platform/hdaps ]]; then
57 ebegin "Loading hdaps module"
58 modprobe hdaps
59 eend $? || return 1
60 fi
61 }
62
63 start() {
64 checkconfig || return 1
65
66 local DISKOPTS DISK
67 for DISK in ${DISKLIST}; do
68 DISKOPTS="-d ${DISK} "
69 done
70
71 ebegin "Starting Hard Drive Active Protection System daemon"
72 start-stop-daemon --start --exec /usr/sbin/hdapsd \
73 --pidfile /var/run/hdapsd.pid \
74 -- --syslog --background --pidfile \
75 ${DISKOPTS} --sensitivity "${THRESHOLD}" ${OPTIONS}
76 eend $?
77 }
78
79 stop() {
80 ebegin "Stopping Hard Drive Active Protection System daemon"
81 start-stop-daemon --stop --exec /usr/sbin/hdapsd \
82 --pidfile /var/run/hdapsd.pid
83 eend $?
84 }
85
86
87
88 1.1 app-laptop/hdapsd/files/hdapsd.conf.2
89
90 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/hdapsd/files/hdapsd.conf.2?rev=1.1&view=markup
91 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/hdapsd/files/hdapsd.conf.2?rev=1.1&content-type=text/plain
92
93 Index: hdapsd.conf.2
94 ===================================================================
95 # The list of the disk devices that hdapsd should monitor.
96 # Usually this is 'hda', 'sda' or 'hda sda'.
97 DISKLIST="sda"
98
99 # hdapsd sensitivity
100 # The lower the threshold is the earlier
101 # the heads are parked when the laptop is shaked
102 THRESHOLD="10"
103
104 # Set any extra options here, like -a for Adaptive mode
105 OPTIONS="-a"