[meta-freescale] [PATCH][fsl-community-bsp-base] setup-environment: check script has been sourced

Otavio Salvador otavio at ossystems.com.br
Fri Jul 11 09:43:49 PDT 2014


On Fri, Jul 11, 2014 at 12:46 PM, Daiane Angolini <daiane.list at gmail.com> wrote:
> On Fri, Jul 11, 2014 at 12:24 PM, Otavio Salvador
> <otavio at ossystems.com.br> wrote:
>> On Fri, Jul 11, 2014 at 10:28 AM, Daiane Angolini <daiane.list at gmail.com> wrote:
>>> On Wed, Jul 9, 2014 at 12:25 PM, Trevor Woerner
>>> <trevor.woerner at linaro.org> wrote:
>> ...
>>>> @@ -55,6 +72,10 @@ ARGS=$(getopt --options $SHORTOPTS  \
>>>>    --longoptions $LONGOPTS --name $PROGNAME -- "$@" )
>>>>  # Print the usage menu if invalid options are specified
>>>>  if [ $? != 0 -o $# -lt 1 ]; then
>>>> +   if [ $INVOKEGOOD = 0 ]; then
>>>> +       echo "Error: This script needs to be sourced. Please run as '. $PROGNAME'"
>>>
>>> I hate using dot "." in documentations or log messages (in fact I
>>> don´t use it any more in my command lines) because I cannot *see* it
>>> when I look to the log/doc line.
>>>
>>> Do you see any problem in the use of "source" instead of ". " (dot +
>>> space) as the suggested command line?
>>>
>>> Other than that I don´t see any technical problem with the patch.
>>
>> The suggested line ought to be using "." as this is POSIX compliant.
>> "source" is Bash specific.
>
>
> I cannot accept that the "POSIX compliant" is the final argument in
> this discussion.
>
> I mean, I´m not saying you are wrong. I´m saying I still cannot see
> the dot even being POSIX compliant!
>
> I would suggest to use a glitter shining intermittent red and pink
> dot, instead. However, it´s too girly even to me.
>
> How to highlight the user that *does not know* how to use the tool
> (otherwise the log is useless) to see the dot?
>
> And, this points an error in our README / Doc files:
>
> https://github.com/Freescale/fsl-community-bsp-platform/blob/daisy/README#L22
>
> https://github.com/Freescale/Documentation/blob/master/user-guide/source/nsteps.rst
> (section 4)
>
>
> However:
> https://github.com/Freescale/fsl-community-bsp-base/blob/master/README#L17

We can print something as:

Error: This script needs to be sourced.

In case you are using Bash as your shell, you can use:

    source ./setup-environment ...

Otherwise, you can use:

    . ./setup-environment ...

so we cover both cases.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


More information about the meta-freescale mailing list