summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/hdparm/files/hdparm-init-8')
-rw-r--r--sys-apps/hdparm/files/hdparm-init-897
1 files changed, 8 insertions, 89 deletions
diff --git a/sys-apps/hdparm/files/hdparm-init-8 b/sys-apps/hdparm/files/hdparm-init-8
index 89aa4f82b7aa..9a4200c8277a 100644
--- a/sys-apps/hdparm/files/hdparm-init-8
+++ b/sys-apps/hdparm/files/hdparm-init-8
@@ -1,24 +1,7 @@
#!/sbin/runscript
-# METHOD
-# ------
-# if /dev/ide exists, find all block devices beneath it named disc, cd, or
-# generic.
-#
-# for the disc and cd ones, if there is a a matching /dev/hdX symlink and
-# hdX_args is set in the config file, use hdX_args. otherwise, if there is a
-# matching /dev/discs/discX or /dev/cdroms/cdromX symlink, and discX_args or
-# cdromX_args is set in the config file, use discX_args / cdromX_args. finally,
-# if all_args is set in the config file, use that.
-#
-# for the generic ones, sort them and look for genericX_args in the config file
-# or use all_args.
-#
-# if /dev/ide does not exist, check the /dev/hdX entries, and see which ones
-# correspond to real devices by opening them for reading. then check hdX_args
-# and all_args in the config file.
-#
-# for each device considered, if no args are found in the config file, do not
-# run hdparm.
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/hdparm/files/hdparm-init-8,v 1.3 2012/04/29 00:30:18 vapier Exp $
depend() {
before bootmisc
@@ -39,77 +22,17 @@ do_hdparm() {
fi
}
-scan_devfs() {
- local extra_args="pata_all_args" device= alias= args=
-
- # devfs compatible systems
- for device in $(find /dev/ide -name disc) ; do
- args=''
-
- for alias in /dev/hd? ; do
- if [ "${alias}" -ef "${device}" ] ; then
- device=${alias}
- eval args=\$"$(basename "${alias}")"_args
- break
- fi
- done
-
- if [ -z "$args" ] ; then
- for alias in /dev/discs/* ; do
- if [ "${alias}"/disc -ef "${device}" ]; then
- device="${alias}/disc"
- eval args=\$"$(basename "${alias}")"_args
- break
- fi
- done
- fi
-
- do_hdparm
- done
-
- for device in $(find /dev/ide -name cd) ; do
- args=''
-
- for alias in /dev/hd? ; do
- if [ "${alias}" -ef "${device}" ] ; then
- device=${alias}
- eval args=\$"$(basename "${alias}")"_args
- break
- fi
- done
-
- if [ -z "$args" ] ; then
- for alias in /dev/cdroms/* ; do
- if [ "${alias}" -ef "${device}" ] ; then
- device=${alias}
- eval args=\$"$(basename "${alias}")"_args
- break
- fi
- done
- fi
-
- do_hdparm
- done
-
- local count=0
- # of course, the sort approach would fail here if any of the
- # host/bus/target/lun numbers reached 2 digits..
- for device in $(find /dev/ide -name generic | sort) ; do
- eval args=\$generic${count}_args
- do_hdparm
- count=$((${count} + 1))
- done
-}
-
scan_nondevfs() {
# non-devfs compatible system
- for device in /dev/hd* /dev/sd* ; do
+ local device
+
+ for device in /dev/hd* /dev/sd* /dev/cdrom* ; do
[ -e "${device}" ] || continue
case "${device}" in
*[0-9]) continue ;;
/dev/hd*) extra_args="pata_all_args" ;;
/dev/sd*) extra_args="sata_all_args" ;;
- *) extra_args="" ;;
+ *) extra_args="_no_xtra_args" ;;
esac
# check that the block device really exists by
@@ -134,9 +57,5 @@ start() {
return 0
fi
- if [ -e /dev/.devfsd -a -d /dev/ide ] ; then
- scan_devfs
- else
- scan_nondevfs
- fi
+ scan_nondevfs
}