Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > bb23757c2103e08e206a6d1231227700 > files > 11

suspend-scripts-1.4-1mdk.noarch.rpm

#!/bin/bash
# -*- Mode: shell-script -*-
# Copyright (C) 2003 by MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com>
# Redistribution of this file is permitted under the terms of the GNU
# Public License (GPL)
#
# suspend: 40
# resume: 50
#

. /etc/sysconfig/suspend

ARG=$1

if [[ $PCMCIA_RESTART != "yes" ]];then
    exit;
fi

function suspend {
    if [[ $PCMCIA_BIOS_BUG == "yes" ]];then
	/sbin/cardctl eject
    else
	/sbin/cardctl suspend
    fi

    if [[ $PCMCIA_WAIT == "yes" ]];then
	until [ `grep "Socket .: empty" /var/run/stab|wc -l` = `grep "Socket" /var/run/stab|wc -l` ]; do
	    logger "Waiting for pcmcia-device to be removed..."
	    sleep 10
	done
    fi
}

function resume {
    if [ $PCMCIA_BIOS_BUG == "yes" ]; then
	/sbin/cardctl insert
    else
	/sbin/cardctl resume
    fi
}

case $ARG in
    suspend)
	suspend
	;;
    resume)
	resume
	;;
esac