On Tue, 2003-11-25 at 15:03, Stefano Zacchiroli wrote:
> On Tue, Nov 25, 2003 at 01:43:45PM +0100, Michel Dänzer wrote:
> >             # Invoke APM scripts
> >             if [ -d /etc/apm/event.d ]; then
> >                     run-parts --arg="suspend" --arg="resume" 
> > /etc/apm/event.d
> >             fi
> >             if [ -d /etc/apm/suspend.d ]; then
> >                     run-parts --arg="suspend" --arg="resume" 
> > /etc/apm/suspend.d
> >             fi
> 
> It seems to me that is possible for some scripts to be linked from
> suspend.d to event.d. Don't you risk to execute some script twice in the
> above way?

Then so would /etc/apm/apmd_proxy; in fact, I wonder why I'm not using
that, instead of duplicating it badly... I seem to remember there used
to be a reason I couldn't use it, but I forget what it was. Of course,
it's a bit inconvenient because you can't have apmd and pmud installed
at the same time, but here's my current version:

function pwrctl_Core99() 
{
        case "$1" in
[...]
        sleep)
[...]
                # Invoke APM scripts
                [ -x /etc/apm/apmd_proxy ] && /etc/apm/apmd_proxy suspend user
[...]
        ;;
        wakeup)
[...]
                # Invoke APM scripts
                [ -x /etc/apm/apmd_proxy ] && /etc/apm/apmd_proxy resume suspend
        ;;
[...]
        esac

        case "$2" in
        ac)
[...]
                # Invoke APM scripts
                [ -x /etc/apm/apmd_proxy ] && /etc/apm/apmd_proxy change power
        ;;
        *)
[...]           # Invoke APM scripts
                [ -x /etc/apm/apmd_proxy ] && /etc/apm/apmd_proxy change power
        ;;
        esac
}


-- 
Earthling Michel Dänzer      |     Debian (powerpc), X and DRI developer
Software libre enthusiast    |   http://svcs.affero.net/rm.php?r=daenzer

Reply via email to