Hi

Temporary solution which i went for

<property environment="en">
 </property>
 <condition property="client" value="${en.COMPUTERNAME}" else="${en.HOSTNAME
}">
            <os family="windows" />
 </condition>



On Wed, Feb 27, 2008 at 2:20 AM, Chuck Holzwarth <[EMAIL PROTECTED]>
wrote:

> Maybe I am missing something, but the simplest fix may be just to set an
> environment variable named COMPUTERNAME during login on the Unix/Linux
> system and it will be available to env.
>
> Sometimes things get more complicated than is necessary...
>
>
> Chuck Holzwarth
>
>
> ----- Original Message ----
> From: David Weintraub <[EMAIL PROTECTED]>
> To: Ant Users List <user@ant.apache.org>
> Sent: Tuesday, February 26, 2008 2:53:25 PM
> Subject: Re: env.COMPUTERNAME not working in linux
>
>
> There
> really
> isn't
> a
> standard
> environment
> variable
> name
> for
> storing
> the
> system
> name
> on
> the
> various
> flavors
> of
> Unix.
> This
> is
> usually
> set
> when
> users
> log
> in.
> Some
> shells
> do
> set
> the
> environment
> variable
> HOSTNAME,
> but
> not
> all.
> Even
> on
> Windows,
> the
> environment
> variable
> COMPUTERNAME
> cannot
> be
> trusted
> because
> it
> can
> changed
> by
> the
> user.
>
> On
> Linux,
> the
> environment
> variable
> HOSTNAME
> is
> set
> by
> the
> default
> shell
> (BASH),
> but
> not
> by
> other
> shells
> like
> Bourne,
> Csh,
> or
> Kornshell.
> You
> could
> simply
> make
> it
> a
> policy
> that
> HOSTNAME
> should
> be
> set
> on
> Unix
> logins
> in
> order
> for
> your
> build
> to
> work.
>
> This
> will
> find
> the
> hostname
> whether
> it
> is
> set
> in
> COMPUTERNAME
> (as
> on
> Windows)
> or
> HOSTNAME
> (as
> normally
> done
> on
> Linux/Unix):
>
> <target
> name="getname">
>
>
>
>
> <property
> environment="env"/>
>
>
>
>
> <condition
> property="hostname"
> value="${env.HOSTNAME}">
>
>
>
>
>
>
> <isset
> property="env.HOSTNAME"/>
>
>
>
>
> </condition>
>
>
>
>
> <condition
> property="hostname"
> value="${env.COMPUTERNAME}">
>
>
>
>
>
>
> <isset
> property="env.COMPUTERNAME"/>
>
>
>
>
> </condition>
>
>
>
>
> <fail
> unless="hostname"
>
>
>
>
>
>
> message="You
> must
> set
> the
> environment
> variable
> HOSTNAME
> or
> COMPUTERNAME
> to
> use
> this
> build
> script"/>
>
>
>
>
> <echo
> message="The
> computer's
> name
> is
> "${hostname}"/>
> </target>
>
>
> On
> Tue,
> Feb
> 26,
> 2008
> at
> 9:09
> AM,
> Ramu
> Sethu
> <[EMAIL PROTECTED]>
> wrote:
> >
> Hi
> >
> >
> We
> have
> a
> build
> script
> which
> runs
> in
> both
> windows
> and
> Linux
> m/c.
> Recently
> i
> >
> added
> property
> to
> print
> the
> computer
> name
> of
> the
> m/c
> in
> which
> the
> script
> >
> runs.
> >
> >
> In
> windows
> everything
> is
> fine.
> Ant
> sets
> the
> property
> to
> the
> hostname
> in
> >
> windows.
> But
> in
> Linux
> it
> prints
> the
> hostname
> like
> "${env.COMPUTERNAME}".
> >
> Value
> is
> not
> printed.
> >
> >
> Is
> COMPUTERNAME
> only
> for
> windows?
> Is
> there
> any
> workaround
> to
> print
> the
> >
> hostname(Linux)?
> >
> >
> We
> don't
> make
> any
> changes
> in
> the
> ant
> script
> when
> running
> in
> Linux.
> >
> >
> --
> >
> Thank
> you
> >
> Ramu
> S
> >
>
>
>
> --
> --
> David
> Weintraub
> [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To
> unsubscribe,
> e-mail:
> [EMAIL PROTECTED]
> For
> additional
> commands,
> e-mail:
> [EMAIL PROTECTED]
>
>
>
>
>
>
>
>
>  
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile.  Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>



-- 
Thank you
Ramu S

 If A is success in life, then A equals x plus y plus z. Work is x; y is
play; and z is keeping your mouth shut.
- Albert Einstein

Reply via email to