Stefan Seyfried wrote: > Holger Macht wrote: > >>On Tue 15. Nov - 04:38:57, Michael Biebl wrote: > > >>>21.) [0.9.25/0.10.19] function keyword in init script is a bashism. Do >>>you really need bash specific features? Otherwise it would be good to >>>use #!/bin/sh in script header and check the scripts with >>>"checkbashisms". That way you can replace the default shell with >>>something lighter like dash. >> >>This would IMO be also good. But I'm not sure how much work this will >>cause. Stefan, can you estimate if there are many bash specific features >>in our scripts? > > > the init script can probably easily be cleared of bashisms, the helper > scripts probably not. > I think we should have a "generic" init-script which will run on any > distribution (but probably not be as nice as the native scripts) and a > collection of distribution specific scripts that fit nicely in the > respective environment. The generic script should contain no bashisms, > the distro-specific scripts can contain whatever the maintainer of the > respective distro wants :-) >
I currently also don't use the initscript that is coming with powersave
but merely used it as a template for my own version of the initscript.
E.g. in Debian we don't have the rc_func functions. Instead I'm using
functions from our lsb_base package. What I copied verbatim is the
load_governor(), load_cpufreq_modules() functions which is imo
unnecessary duplication of code. What about refactoring this helper
functions into a separate support script. A custom init script could
then just source this file and use the functions. That way the init
script would become much more readable and concise too.
Something like:
#!/bin/sh
# LSB header
/usr/lib/powersave/init_funcs
[Some init stuff, settings for variables etc, can be distribution specific]
case "$1" in
start)
Print start message (use distribution specific mechanism)
helper_func1 (load modules)
helper_func2 (...)
...
Start daemon (use distribution specific mechanism)
Print end message (use distribution specific mechanism)
;;
stop)
...
esac;
exit 0
Cheers,
Michael
--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
signature.asc
Description: OpenPGP digital signature
_______________________________________________ powersave-devel mailing list [email protected] http://forge.novell.com/mailman/listinfo/powersave-devel
