hal-system-power-* scripts
David Zeuthen
david at fubar.dk
Tue Sep 20 09:16:24 PDT 2005
On Tue, 2005-09-20 at 16:48 +0100, Richard Hughes wrote:
> Surely distro A would only have the tool that works pre-installed?
>
But you just argued that a distro would have several tools installed and
we would have to filter.
Btw, my view is that a distro that allows the user to replace e.g. power
management scripts and more serious stuff (like the user can replace the
kernel with an elite custom compiled kernel) is more or less broken by
design, but that is another discussion :-).
> Fedora isn't going to have PowerSave installed, just like SuSe isn't
> going to have pmi installed.
>
> > I don't see a problem that each distro filter on tools separately
> > though.
>
> Okay, what about a compromise.
>
> Filter by distro (Redhat = pm-utils, SuSe = PowerSave) (like we have in
> CVS) and then fallback to looking for the tools (like I proposed) for
> the other Distros.
At best it would look like this (in pseudo-code) - note that Debian
wants to try tool1 before tool2 (because tool1 is more likely to work
with the default kernel) and Gentoo does the opposite (because tool2 is
more likely to work with the default kernel).
Cheers,
David
switch distro:
case fedora:
do pm-suspend
exit
case suse:
do powersave
exit
case debian:
if exists tool1:
do tool1
exit
elif exists tool2:
do tool2
exit
fi
case gentoo:
if exists tool2:
do tool2
exit
elif exists tool1:
do tool1
exit
elif exists tool3:
do tool3
exit
fi
... (other distros go here)
# catch all for unsupported distros
if exists tool1:
do tool1
exit
elif exists tool2:
do tool2
exit
elif exists tool3:
do tool3
exit
fi
# not supported, throw exception
throw NotSupported
More information about the hal
mailing list