#!/bin/sh
# -*- Mode: shell-script -*-

[ -e /etc/sysconfig/apmd ] && . /etc/sysconfig/apmd

# Some broken disks won't return from a suspend to disk
# unless they're set to 100% failsafe settings with hdparm.
# Typically, notebooks with SystemSoft MobilePRO BIOS are
# affected by this.

if test "x$HDPARM_AT_SUSPEND" != "x"; then
    for i in /proc/ide/hd*; do
	DRIVE=/dev/`echo $i |sed -e "s,.*/,,g"`
	if test "x`cat $i/media`" = "xdisk"; then
	    hdparm $HDPARM_AT_SUSPEND $DRIVE
	fi
    done
fi
sync
