[OE-core] [PATCH 1/1] sysvinit: start .sh scripts correctly

ChenQi Qi.Chen at windriver.com
Tue Feb 26 02:45:51 UTC 2013


On 02/26/2013 10:00 AM, Saul Wold wrote:
> On 02/25/2013 05:39 PM, Qi.Chen at windriver.com wrote:
>> From: Chen Qi <Qi.Chen at windriver.com>
>>
>> Previously, scripts which end with '.sh' were sourced, so the arguments
>> like 'start' and 'stop' were just ignored.
>>
>> This resulted in some init scripts not being able to start correctly.
>> For example, sourcing hwclock.sh in busybox actually does nothing.
>> It should be invoked as 'hwclock.sh start' or 'hwclock.sh stop'.
>>
>> This patch fixes this issue.
>>
>> [YOCTO #3612]
>>
>> Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
>> ---
>>   meta/recipes-core/sysvinit/sysvinit/rc |   16 +---------------
>>   1 file changed, 1 insertion(+), 15 deletions(-)
>>
>> diff --git a/meta/recipes-core/sysvinit/sysvinit/rc 
>> b/meta/recipes-core/sysvinit/sysvinit/rc
>> index 44bc9bf..50951da 100755
>> --- a/meta/recipes-core/sysvinit/sysvinit/rc
>> +++ b/meta/recipes-core/sysvinit/sysvinit/rc
>> @@ -41,21 +41,7 @@ startup_progress() {
>>   startup() {
>>     # Handle verbosity
>>     [ "$VERBOSE" = very ] && echo "INIT: Running $@..."
>> -
>> -  case "$1" in
>> -    *.sh)
>> -        # Source shell script for speed.
>> -        (
>> -            trap - INT QUIT TSTP
>
> Are you sure you don't want the trap still?  I realize this reset it 
> to default..
>
Yes.

Code snippet from rc:
   # Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
   trap ":" INT QUIT TSTP

So these signals are ignored in rc but passed on to subprocesses.
And the reset is not needed.

If in rc we use
     trap "" INIT QUIT TSTP
then the reset is needed.

Best Regards,
Chen Qi

> Sau!
>
>> -            scriptname=$1
>> -            shift
>> -            . $scriptname
>> -        )
>> -        ;;
>> -    *)
>> -        "$@"
>> -        ;;
>> -  esac
>> +  "$@"
>>     startup_progress
>>   }
>>
>>
>
>





More information about the Openembedded-core mailing list