Author: glen                         Date: Sun Jan 28 11:59:21 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- optimize for empty config doing nothing

---- Files affected:
SOURCES:
   hdparm.init (1.16 -> 1.17) 

---- Diffs:

================================================================
Index: SOURCES/hdparm.init
diff -u SOURCES/hdparm.init:1.16 SOURCES/hdparm.init:1.17
--- SOURCES/hdparm.init:1.16    Sat Dec 20 01:08:44 2003
+++ SOURCES/hdparm.init Sun Jan 28 12:59:16 2007
@@ -1,14 +1,22 @@
 #!/bin/sh
 
+[ -f /etc/sysconfig/hdparm ] || exit 0
+
+blockdevs=$(awk -F= '!/^#/ && !/^$/ {if ($2) print $1}' /etc/sysconfig/hdparm)
+if [ -z "$blockdevs" ]; then
+       exit 0
+fi
+
 # Source function library
 . /etc/rc.d/init.d/functions
 
-# Get service config
-[ -f /etc/sysconfig/hdparm ] && . /etc/sysconfig/hdparm
+# Source hdparm configureation.
+. /etc/sysconfig/hdparm
 
-for drive in $(ls /proc/ide 2> /dev/null); do
+for var in $blockdevs; do
+       drive=${var#HDPARM_}
        if [ -L "/proc/ide/${drive}" ]; then
-               eval PARAMS=\$HDPARM_${drive}
+               eval PARAMS=\$$var
                if [ -n "${PARAMS}" ]; then
                        show "Setting parameters for drive %s (%s)" "$drive" 
"$PARAMS"
                        busy
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/hdparm.init?r1=1.16&r2=1.17&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to