1 |
92ac3b3d
|
jim-p
|
#!/bin/sh
|
2 |
ac24dc24
|
Renato Botelho
|
#
|
3 |
|
|
# rc.disable_hdd_apm
|
4 |
|
|
#
|
5 |
|
|
# part of pfSense (https://www.pfsense.org)
|
6 |
38809d47
|
Renato Botelho do Couto
|
# Copyright (c) 2004-2013 BSD Perimeter
|
7 |
|
|
# Copyright (c) 2013-2016 Electric Sheep Fencing
|
8 |
0284d79e
|
jim-p
|
# Copyright (c) 2014-2020 Rubicon Communications, LLC (Netgate)
|
9 |
ac24dc24
|
Renato Botelho
|
# All rights reserved.
|
10 |
|
|
#
|
11 |
b12ea3fb
|
Renato Botelho
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
12 |
|
|
# you may not use this file except in compliance with the License.
|
13 |
|
|
# You may obtain a copy of the License at
|
14 |
ac24dc24
|
Renato Botelho
|
#
|
15 |
b12ea3fb
|
Renato Botelho
|
# http://www.apache.org/licenses/LICENSE-2.0
|
16 |
ac24dc24
|
Renato Botelho
|
#
|
17 |
b12ea3fb
|
Renato Botelho
|
# Unless required by applicable law or agreed to in writing, software
|
18 |
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
19 |
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20 |
|
|
# See the License for the specific language governing permissions and
|
21 |
|
|
# limitations under the License.
|
22 |
92ac3b3d
|
jim-p
|
|
23 |
2a10f892
|
Renato Botelho
|
CAMCONTROL=/sbin/camcontrol
|
24 |
92ac3b3d
|
jim-p
|
for i in /dev/ad?; do
|
25 |
b08e147f
|
jim-p
|
if [ ! -e ${i} ]; then
|
26 |
|
|
continue;
|
27 |
|
|
fi
|
28 |
2a10f892
|
Renato Botelho
|
|
29 |
|
|
ENABLED=$(${CAMCONTROL} identify ${i} \
|
30 |
|
|
| grep "advanced power management" | awk '{print $5}')
|
31 |
|
|
|
32 |
|
|
if [ "${ENABLED}" = "no" ]; then
|
33 |
|
|
continue
|
34 |
|
|
fi
|
35 |
|
|
|
36 |
|
|
SUPPORTED=$(${CAMCONTROL} identify ${i} \
|
37 |
|
|
| grep "advanced power management" | awk '{print $4}')
|
38 |
|
|
|
39 |
|
|
if [ "${SUPPORTED}" != "no" ]; then
|
40 |
92ac3b3d
|
jim-p
|
echo Disabling APM on $i
|
41 |
2a10f892
|
Renato Botelho
|
${CAMCONTROL} apm ${i}
|
42 |
92ac3b3d
|
jim-p
|
fi
|
43 |
|
|
done
|