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

ChenQi Qi.Chen at windriver.com
Wed Feb 27 03:26:38 UTC 2013


On 02/26/2013 07:04 PM, Burton, Ross wrote:
> On 26 February 2013 01:39,  <Qi.Chen at windriver.com> wrote:
>> -
>> -  case "$1" in
>> -       *.sh)
>> -               # Source shell script for speed.
>> -               (
>> -                       trap - INT QUIT TSTP
>> -                       scriptname=$1
>> -                       shift
>> -                       . $scriptname
>> -               )
>> -               ;;
>> -       *)
>> -               "$@"
>> -               ;;
>> -  esac
>> +  "$@"
>>     startup_progress
>>   }
> NACK.
>
> By "fix" you mean "remove the tested and proven optimisation"? The "if
> .sh use ." test was designed to speed up booting by not forking a new
> bash, and it's been demonstrated to have a noticeable difference on
> slower hardware.
>
> You can pass arguments to "." as this little test demonstrates:
>
> $ cat service.sh
> echo My arguments are "$@"
> $ . service.sh foo bar
> My arguments are foo bar
>
> The "shift" command shows that passing the arguments to the script was
> the intention, and a few lines of micro-test demonstrate that it
> *should* work:
>
> $ cat rc.sh
> startup() {
>      scriptname=$1
>      shift
>      . $scriptname
> }
> startup ./service.sh start
> $ busybox sh ./rc.sh
> My arguments are start
>
> So, something else is going wrong.
>
> Ross
>
>
Yes, you're right.
I absolutely made a mistake.

Thank you for pointing it out.

Best Regards,
Chen Qi




More information about the Openembedded-core mailing list