[Pm-utils] RFC - PATCH to functions.in to support Slackware init

Victor Lowther victor.lowther at gmail.com
Wed Oct 29 14:44:39 PDT 2008


On Oct 29, 2008, at 4:02 PM, Robby Workman <rw at rlworkman.net> wrote:

> On Wed, 29 Oct 2008 15:49:39 -0500
> Victor Lowther <victor.lowther at gmail.com> wrote:
>
>> I rewrote your patch a little:
>>
>> diff --git a/pm/functions.in b/pm/functions.in
>> index 110282e..b1b3157 100644
>> --- a/pm/functions.in
>> +++ b/pm/functions.in
>> @@ -129,14 +129,12 @@ modreload()
>> if ! command_exists service; then
>>        service()
>>        {
>> -               if [ -x "/etc/init.d/$1" ]; then
>> -                       svc="$1"
>> -                       shift
>> -                       "/etc/init.d/$svc" "$@"
>> -               else
>> -                       log "${1}: unrecognized service"
>> -                       return 1
>> -               fi
>> +           for svc in "/etc/init.d/$1" "/etc/rc.d/rc.$1" #lsb, then
>> slack
>> +               [ -x "$svc" ] && { shift; "$svc" "$@"; return $?; }
>> +           done
>> +           # this only happens if we did not find the service
>> +           log "${1}: unrecognized service"
>> +           return 1
>>        }
>> fi
>
>
> That works; fine by me :)
>
>
>> A better way to do it might be to add a distro.d directory
>> to /usr/lib/pm-utils that can have the following content:
>>
>> pm-functions: Sourced at the end of /usr/lib/pm-utils/pm-functions if
>> present.
>>
>> functions:  Sourced at the end in /usr/lib/pm-utils/functions if
>> present.
>
>
> I like the idea, I think.  I almost prefer to have those named in a
> format of "$distro.functions" and "$distro.pm-functions" though.
> This, of course, would require testing if the directory is not empty
> and then sourcing all of its contents if not, or perhaps this, to add
> (probably needless) complexity:  a --with-distro=$distro configure
> flag, and then configure could write that value into the stock
> functions files so that it knows what to source.  Did that make any
> sense? :-)

Well, Part of the idea is that upstream pm-utils would not do anything  
in the distro.d directory - it would be there for the distros to use  
or ignore as they choose. I don't want to be in the business of  
maintaining every distro-specific method for doing something out there  
- I just want to provide sane defaults and make it easy for distro  
maintainers to customize things. Giving y'all a designated place and a  
method to do so is part of that goal.

> If that path is chosen, the configure help should probably clarify  
> that
> it really doesn't matter what someone puts there -- the value could
> conceivably be something asinine like LemonPartyUSA and it would work
> so long as the add-on files were named likewise. ;-)
>
>
>> These files will allow distros to override and add new functionality
>> to pm-utils without having to patch the pm-utils package to do so.
>>
>> power.d, sleep.d, config.d, and modules.d:
>>
>> These directories would have the same purpose as the ones
>> in /usr/lib/pm-utils and /etc/pm.  Their contents would override the
>> ones in /usr/lib/pm-utils, and would be overridden by the ones
>> in /etc/pm.
>
>
> Same story about $distro on these -- would prefer names such as
> "$distro.power.d" and such.  However, I think these are less important
> (at least for now), but could very well be useful.

They will be in the pm-utils 2.0 timeframe, when most of the non core  
hooks get pushed to their respective packages.

>
> -RW


More information about the Pm-utils mailing list