#!/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 # Source hdparm configuration. . /etc/sysconfig/hdparm for var in $blockdevs; do drive=${var#HDPARM_} # check if it is some ID if [ -L /dev/disk/by-id/ata-$drive ]; then dev=$(readlink -f /dev/disk/by-id/ata-$drive) elif [ -L /dev/disk/by-id/scsi-$dev ]; then dev=$(readlink -f /dev/disk/by-id/scsi-$drive) else dev=$drive fi # strip /dev dev=${dev#/dev/} if [ -L "/proc/ide/$dev" -o -d "/sys/block/$dev" ]; then eval PARAMS=\$$var if [ -n "$PARAMS" ]; then show "Setting parameters for drive %s (%s)" "$drive" "$PARAMS" busy /sbin/hdparm $PARAMS /dev/$dev ok fi fi done exit 0