diff options
Diffstat (limited to 'sys-apps/hdparm/files')
-rw-r--r-- | sys-apps/hdparm/files/digest-hdparm-6.6 | 3 | ||||
-rw-r--r-- | sys-apps/hdparm/files/hdparm-conf.d.3 | 11 | ||||
-rw-r--r-- | sys-apps/hdparm/files/hdparm-init-7 | 157 |
3 files changed, 94 insertions, 77 deletions
diff --git a/sys-apps/hdparm/files/digest-hdparm-6.6 b/sys-apps/hdparm/files/digest-hdparm-6.6 new file mode 100644 index 000000000000..6fc9620e21cc --- /dev/null +++ b/sys-apps/hdparm/files/digest-hdparm-6.6 @@ -0,0 +1,3 @@ +MD5 ecea69f775396e4ab6112dcf9066239f hdparm-6.6.tar.gz 45538 +RMD160 714fbc5216bdb427c7e817649f3c4f5462620c13 hdparm-6.6.tar.gz 45538 +SHA256 7e2db39a4e1f41bb327a9a8ef9e5e8359aaed0cc78e642a4ca67659629e3048b hdparm-6.6.tar.gz 45538 diff --git a/sys-apps/hdparm/files/hdparm-conf.d.3 b/sys-apps/hdparm/files/hdparm-conf.d.3 index d47c205606fb..ae4c454a7b62 100644 --- a/sys-apps/hdparm/files/hdparm-conf.d.3 +++ b/sys-apps/hdparm/files/hdparm-conf.d.3 @@ -7,6 +7,11 @@ # disc1_args="-d1" # cdrom0_args="-d1" -# or, you can set hdparm options for ALL drives using all_args, e.g. -# -all_args="-d1" +# or you can set options for all PATA drives +pata_all_args="-d1" + +# or you can set options for all SATA drives +sata_all_args="" + +# or, you can set hdparm options for all drives +all_args="" diff --git a/sys-apps/hdparm/files/hdparm-init-7 b/sys-apps/hdparm/files/hdparm-init-7 index 231d42021d47..559db1f389cd 100644 --- a/sys-apps/hdparm/files/hdparm-init-7 +++ b/sys-apps/hdparm/files/hdparm-init-7 @@ -25,7 +25,7 @@ depend() { } do_hdparm() { - if [[ ${args:=$all_args} ]] ; then + if [[ -n ${args:=${all_args} ${!extra_args}} ]] ; then local orgdevice=$(readlink -f ${device}) if [[ -b ${orgdevice} ]] ; then ebegin "Running hdparm on ${device}" @@ -35,96 +35,105 @@ do_hdparm() { fi } -start() { +scan_devfs() { + extra_args="pata_all_args" - if [ -e /dev/.devfs ] && [ -d /dev/ide ] - then + # devfs compatible systems + for device in $(find /dev/ide -name disc) + do + args='' - # devfs compatible systems - for device in $(find /dev/ide -name disc) + for alias in /dev/hd? 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 - + if [ $alias -ef $device ] + then + device=$alias + eval args=\${`basename $alias`_args} + break + fi done - for device in $(find /dev/ide -name cd) + [ -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 - 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 - do_hdparm + done - done + for device in $(find /dev/ide -name cd) + do + + args='' - 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) + for alias in /dev/hd? do - eval args=\${generic${count}_args} - do_hdparm - let count=count+1 + if [ $alias -ef $device ] + then + device=$alias + eval args=\${`basename $alias`_args} + break + fi done - else - - # non-devfs compatible system - for device in /dev/hd? + [ -z "$args" ] && for alias in /dev/cdroms/* do - # check that the block device really exists - # by opening it for reading - local errmsg status - errmsg=$(: 2>&1 <$device) - status=$? - if [[ -b $device ]] && [[ ${status} == 0 || ${errmsg} == *": No medium found" ]] + if [ $alias -ef $device ] then - eval args=\${`basename $device`_args} - do_hdparm + device=$alias + eval args=\${`basename $alias`_args} + break fi done + 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)) + done +} + +scan_nondevfs() { + # non-devfs compatible system + for device in /dev/hd? /dev/sd? ; do + case ${device} in + /dev/hd*) extra_args="pata_all_args" ;; + /dev/sd*) extra_args="sata_all_args" ;; + *) extra_args="" ;; + esac + + # check that the block device really exists by + # opening it for reading + local errmsg status + errmsg=$(: 2>&1 <$device) + status=$? + if [[ -b $device ]] && \ + [[ ${status} == 0 || ${errmsg} == *": No medium found" ]] + then + local conf_var="${device##*/}_args" + args=${!conf_var} + do_hdparm + fi + done +} + +start() { + if [[ -e /dev/.devfs ]] && [[ -d /dev/ide ]] ; then + scan_devfs + else + scan_nondevfs fi } |