diff options
author | Heinrich Wendel <lanius@gentoo.org> | 2004-08-01 14:43:43 +0000 |
---|---|---|
committer | Heinrich Wendel <lanius@gentoo.org> | 2004-08-01 14:43:43 +0000 |
commit | 1f6a99212d1f597c6459c0b5d8b2519e377bc99a (patch) | |
tree | 76695e68d2f077ceb9577437b6c9876114c55210 /sys-apps/hdparm/files | |
parent | Added to ~ppc (diff) | |
download | historical-1f6a99212d1f597c6459c0b5d8b2519e377bc99a.tar.gz historical-1f6a99212d1f597c6459c0b5d8b2519e377bc99a.tar.bz2 historical-1f6a99212d1f597c6459c0b5d8b2519e377bc99a.zip |
great enhancements of the init script, see bug #37755, remove old version
Diffstat (limited to 'sys-apps/hdparm/files')
-rw-r--r-- | sys-apps/hdparm/files/digest-hdparm-5.3-r2 | 1 | ||||
-rw-r--r-- | sys-apps/hdparm/files/digest-hdparm-5.5-r1 | 1 | ||||
-rw-r--r-- | sys-apps/hdparm/files/hdparm-conf.d.3 | 14 | ||||
-rw-r--r-- | sys-apps/hdparm/files/hdparm-init | 14 | ||||
-rw-r--r-- | sys-apps/hdparm/files/hdparm-init-2 (renamed from sys-apps/hdparm/files/hdparm-new-init) | 2 | ||||
-rw-r--r-- | sys-apps/hdparm/files/hdparm-init-3 | 132 |
6 files changed, 148 insertions, 16 deletions
diff --git a/sys-apps/hdparm/files/digest-hdparm-5.3-r2 b/sys-apps/hdparm/files/digest-hdparm-5.3-r2 deleted file mode 100644 index 9d54b2662de0..000000000000 --- a/sys-apps/hdparm/files/digest-hdparm-5.3-r2 +++ /dev/null @@ -1 +0,0 @@ -MD5 86c4d4508ce8289132bc6fdf71b5a5a9 hdparm-5.3.tar.gz 35837 diff --git a/sys-apps/hdparm/files/digest-hdparm-5.5-r1 b/sys-apps/hdparm/files/digest-hdparm-5.5-r1 new file mode 100644 index 000000000000..f3fa36d6a5d7 --- /dev/null +++ b/sys-apps/hdparm/files/digest-hdparm-5.5-r1 @@ -0,0 +1 @@ +MD5 b3d65aa96d93fc08bc807fd1d9497c21 hdparm-5.5.tar.gz 38215 diff --git a/sys-apps/hdparm/files/hdparm-conf.d.3 b/sys-apps/hdparm/files/hdparm-conf.d.3 new file mode 100644 index 000000000000..f356708750a1 --- /dev/null +++ b/sys-apps/hdparm/files/hdparm-conf.d.3 @@ -0,0 +1,14 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/hdparm/files/hdparm-conf.d.3,v 1.1 2004/08/01 14:43:43 lanius Exp $ + +# You can either set hdparm arguments for each drive using hdX_args, +# discX_args, cdromX_args and genericX_args, e.g. +# +# hda_args="-d1 -X66" +# disc1_args"-d1" +# cdrom0_args="-d1" + +# or, you can set hdparm options for ALL drives using all_args, e.g. +# +all_args="-d1" diff --git a/sys-apps/hdparm/files/hdparm-init b/sys-apps/hdparm/files/hdparm-init deleted file mode 100644 index 5729da360edc..000000000000 --- a/sys-apps/hdparm/files/hdparm-init +++ /dev/null @@ -1,14 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/hdparm/files/hdparm-init,v 1.4 2004/07/15 00:43:00 agriffis Exp $ - -depend() { - need localmount -} - -start() { - ebegin "Enabling DMA on IDE drives" - /sbin/hdparm -d1 /dev/ide/hd/*u? &> /dev/null - eend $? -} diff --git a/sys-apps/hdparm/files/hdparm-new-init b/sys-apps/hdparm/files/hdparm-init-2 index f4db73f4923b..ba9bd607492e 100644 --- a/sys-apps/hdparm/files/hdparm-new-init +++ b/sys-apps/hdparm/files/hdparm-init-2 @@ -2,7 +2,7 @@ # Copyright 1999-2004 Gentoo Foundation # Copyright 2003 Justin "Nagash" Jones # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/hdparm/files/hdparm-new-init,v 1.5 2004/07/15 00:43:00 agriffis Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/hdparm/files/hdparm-init-2,v 1.1 2004/08/01 14:43:43 lanius Exp $ depend() { need localmount diff --git a/sys-apps/hdparm/files/hdparm-init-3 b/sys-apps/hdparm/files/hdparm-init-3 new file mode 100644 index 000000000000..68dff193d3e1 --- /dev/null +++ b/sys-apps/hdparm/files/hdparm-init-3 @@ -0,0 +1,132 @@ +#!/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. + + +depend() { + before bootmisc +} + + +do_hdparm() { + if [[ ${args:=$all_args} ]] + then + ebegin "Running hdparm on $device" + hdparm -q $args $device || ewarn "Failed to run hdparm on $device" + fi +} + + +start() { + + ebegin 'Starting hdparm' + + which hdparm &>/dev/null + eend $? 'hdparm executable not found' + + if [ -e /dev/.devfsd ] || [ -e /dev/.udev ] + then + + # devfs and udev system + for device in $(find /dev/ide -type b -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 + + [ -z $args ] && for alias in /dev/discs/* + do + if [ $alias/disc -ef $device ] + then + device=$alias/disc + eval args=\${`basename $alias`_args} + break + fi + done + + do_hdparm + + done + + for device in $(find /dev/ide -type b -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 + + [ -z $args ] && for alias in /dev/cdroms/* + do + if [ $alias -ef $device ] + then + device=$alias + eval args=\${`basename $alias`_args} + break + fi + done + + do_hdparm + + done + + let 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 -type b -name generic | sort) + do + eval args=\${generic${count}_args} + do_hdparm + let count=count+1 + done + + else + + # non-devfs system + for device in /dev/hd? + do + # check that the block device really exists + # by opening it for reading + if [ -b $device ] && ( : <$device ) 2>/dev/null + then + eval args=\${`basename $device`_args} + do_hdparm + fi + done + + fi +} |