[Pm-utils] RFC - PATCH to functions.in to support Slackware init
Robby Workman
rw at rlworkman.net
Tue Oct 7 12:40:08 PDT 2008
Attached is an "idea" patch - in other words, I don't intend for this
to be considered for committing upstream; rather, I'm really just
wanting to flesh out whether what I have in mind is horribly bad. :-)
Here's the patch (it's also attached, in case some mail clients munge
the content. My thoughts are *in* the patch ; responses? :-)
diff -Nur pm-utils-1.2.2.1.orig/pm/functions.in pm-utils-1.2.2.1/pm/functions.in
--- pm-utils-1.2.2.1.orig/pm/functions.in 2008-10-05 20:49:09.000000000 -0500
+++ pm-utils-1.2.2.1/pm/functions.in 2008-10-07 14:33:26.081012472 -0500
@@ -124,15 +124,34 @@
done
}
-# Service management is sysv dependent.
-# TODO: modularize this to make it work with other init systems.
+# Some comments...
+#
+# I'm not sure the command_exists() function is broad enough to catch
+# all instances we want. While dbus isn't a good example for actual
+# suspend and such (as we don't want to stop/restart it at all), it *is*
+# a good example of something that command_exists() would miss, as (at
+# least in our case), the service is typically called "dbus," the daemon
+# is called "dbus-daemon," and the init script is named "rc.messagebus"
+# I don't know of a good/better way to handle it though, really.
+#
+# Also, we (Slackware) have some init scripts that don't have a "status"
+# directive in them, so maybe using that to check if something is running
+# won't always work. Is "pgrep $service" acceptable (although that will
+# still miss stuff due to the above paragraph's concerns)?
+
if ! command_exists service; then
service()
{
+ # Pure SysV init
if [ -x "/etc/init.d/$1" ]; then
svc="$1"
shift
"/etc/init.d/$svc" "$@"
+ # Slackware's BSD-style SysV init
+ elif [ -x "/etc/rc.d/rc.${1}" ]; then
+ svc="$1"
+ shift
+ "/etc/rc.d/rc.${1}" "$@"
else
log "${1}: unrecognized service"
return 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pm-utils-functions.in.patch
Type: text/x-patch
Size: 1531 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/pm-utils/attachments/20081007/bfe82537/attachment.bin
More information about the Pm-utils
mailing list