--- hdparm.orig 2004-09-05 14:51:40.510619933 +0300 +++ hdparm 2004-09-05 14:53:09.374163757 +0300 @@ -21,112 +21,112 @@ # run hdparm. depend() { - before bootmisc + before bootmisc } do_hdparm() { - if [[ ${args:=$all_args} ]] - then + if [[ ${args:=$all_args} ]] + then orgdevice=`readlink -f $device` if [ -b $orgdevice ]; then - ebegin "Running hdparm on $device" - hdparm $args $device > /dev/null || ewarn "Failed to run hdparm on $device" + ebegin "Running hdparm on $device" + hdparm $args $device > /dev/null || ewarn "Failed to run hdparm on $device" fi - fi + fi } start() { - ebegin 'Starting hdparm' + ebegin 'Starting hdparm' - which hdparm &>/dev/null - eend $? 'hdparm executable not found' + which hdparm &>/dev/null + eend $? 'hdparm executable not found' - if [ -e /dev/.devfsd ] || [ -e /dev/.udev ] - then + if [ -d /dev/ide ] + then # devfs and udev system - for device in $(find /dev/ide -name disc) - do + for device in $(find /dev/ide -name disc) + do - args='' + 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 -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 + 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 -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 ] + 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 -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 + 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 -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 + fi }