NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Does build.sh dump things into /usr/obj/ ?



Christian Baer wrote:
>> if ! [  -n "$ARCH" ] ; then
>>     ARCH=`uname -m`
>> fi
> 
> Ok, this part I don't quite get. Why another "if"? I would have done
> that by just using an "else" within the first if, something like this:
> 
>   if [ $# -gt 0 ] ; then
>     ARCH=$1
>   else
>     ARCH=`uname -m`
>   fi
> 
> Or won't that work?

   Sure it will -- but I removed it since it's the default. If you don't
set ARCH, build.sh will set it automatically.

[---]
>> if ! [ -d $MAKEOBJDIRPREFIX ] ; then
>>     mkdir -p $MAKEOBJDIRPREFIX
>> fi
> 
> Maybe it would be a good idea to check if the current user has write
> privileges in the Basedir *before* trying to create all the directories.
> The error messages mkdir would spit out could give a hint :-) but the
> script should be able to give a hint to the user too.

   Well -- true. But I wrote the script because I was lazy, not because
I wanted an intelligent script. :-)

> 
>> --[prep_build_env.sh]------------------------
>>
>>    Just go into the directory where you want all of the files to be
>> stored. Run this script, then run build.sh with the appropriate flags.
>> Obviously, you need to run the script in the shell's process:
>> $ . prep_build_env.sh
> 
> Not sure what you mean by that. :-(

   When you run a script "normally", a new process is created for it.
(Try writing a shell script which only contains a "sleep 60"-line, run
it, and and run "ps -ax" -- you'll see that a new shell has been started
for your script. All those "export FOO=bar" go into that shell-process'
private memory. Once the script terminates, all those variables will be
lost.

   If you run a script like this:

   $ . foo.sh

   ..you're telling the shell to run the script in the current shell.
The variables won't be lost this way.

-- 
Kind regards,
Jan Danielsson


Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index