[Pm-utils] pm-action

Richard Hughes hughsient at gmail.com
Fri Jun 9 16:03:26 PDT 2006


Okay, currently we have pm-action that does both suspend and hibernate
based on the link name.

This breaks package based setups (unless we do 2x ln -s in the spec
file) which is a potential bug for each distro packaging pm-utils.

Currently the action is done based on the link name, which is inherently
fragile in my opinion.

Considering the pm-action file is only a few lines long:

export LC_COLLATE=C
. /etc/pm/functions
[ -f /sys/power/disk ] || exit 1
[ -f /sys/power/state ] || exit 1
ACTION=$(basename "$0")
ACTION=${ACTION#pm-}
pm_main "$ACTION"
exit $?

I think it would be sane to install *two* files pm-suspend and
pm-hibernate that just did:

export LC_COLLATE=C
. /etc/pm/functions
[ -f /sys/power/disk ] || exit 1
[ -f /sys/power/state ] || exit 1
pm_main suspend
exit $?

*and*

export LC_COLLATE=C
. /etc/pm/functions
[ -f /sys/power/disk ] || exit 1
[ -f /sys/power/state ] || exit 1
pm_main hibernate
exit $?

which seems less fragile as it doesn't depend on the link name (as other
distro's may want a different name linking to these scripts for
compatibility) and is simpler and shorter.

I'm happy to make the changes, and create the two sgml man pages
required for pm-suspend and pm-hibernate if this is agreed a good idea.

Comments please.

Richard.




More information about the Pm-utils mailing list