[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    Re: [gentoo-dev]  init.d-scripts don't see stuff from	/etc/profile.env
From:       Francesco R <vivo () gentoo ! org>
Date:       2005-08-30 22:36:20
Message-ID: 4314DF64.5030402 () gentoo ! org
[Download RAW message or body]

Roy Marples wrote:

>I just love replying to myself!
>
>On Tue, 2005-08-30 at 22:32 +0100, Roy Marples wrote:
>  
>
>>#!/bin/sh
>>
>>/bin/env -i \
>>    CONSOLETYPE="${CONSOLETYPE}" \
>>    IN_BACKGROUND="${IN_BACKGROUND}" \
>>    IN_HOTPLUG="${IN_HOTPLUG}" \
>>    /lib/rcscripts/sh/runscript.sh $*
>>    
>>
>
>A quick reboot shows we need much more. Here's what works on my system
>
>/bin/env -i \
>    BOOT="${BOOT}" \
>    CONSOLETYPE="${CONSOLETYPE}" \
>    CRITICAL_SERVICES="${CRITICAL_SERVICES}" \
>    START_CRITICAL="${START_CRITICAL}" \
>    STOP_CRTIICAL="${STOP_CRITICAL}" \
>    OLDSOFTLEVEL="${OLDSOFTLEVEL}" \
>    SOFTLEVEL="${SOFTLEVEL}" \
>    IN_BACKGROUND="${IN_BACKGROUND}" \
>    IN_HOTPLUG="${IN_HOTPLUG}" \
>    /lib/rcscripts/sh/runscript.sh $*
>
>
>  
>
>>Right away we can see that we actually do need some to keep some env
>>vars and the list would be constantly updated. There's also nothing to
>>stop the user from setting them and then running a script which kind of
>>defeats the purpose here anyway.
>>
>>Personally I'm against this.I'd like to know what Azarah and Vapier
>>think of this though. Others too!
>>    
>>
>
>I think I just added a few more reasons why I don't like this ....
>
>Roy
>
>  
>
Read only the last three messages of the thread, hoping to not say
idiotic things.
Rewriting the previous script in the following manner:

[code]
VARS_TO_EXPORT="BOOT CONSOLETYPE CRITICAL_SERVICES START_CRITICAL
STOP_CRITICAL OLDSOFTLEVEL SOFTLEVEL IN_BACKGROUND IN_HOTPLUG"

RUNSCRIPT="/bin/env -i"
for i in ${VARS_TO_EXPORT} ; do
    RUNSCRIPT="${RUNSCRIPT} ${i}=\${${i}}"
done
RUNSCRIPT="${RUNSCRIPT} /lib/rcscripts/sh/runscript.sh $*"
eval $RUNSCRIPT
[/code]

should make it easyer to maintain, also "VARS_TO_EXPORT" could be placed
in /etc/rc.conf (with a better name) .
Running the rc scripts from a clean environment make easyer to debug
things, it caused at least one headheache to me installing SuSE + apache
+ php + informix some years ago.

just my 2 cents.

-- 
gentoo-dev@gentoo.org mailing list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic