zsh-users
 help / color / mirror / code / Atom feed
* How to display zsh is 32/64 bit?
@ 2011-12-09  4:34 Daniel Lin
  2011-12-09  8:04 ` Thomas Köhler
  2011-12-09 13:49 ` Peter Stephenson
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Lin @ 2011-12-09  4:34 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

To do cross compile of 32/64 bit program on one machine.(which installed
64-bit zsh)
I use ArchLinux x86_64 as host machine.
And a arch32 chroot environment for 32-bit compiling(which installed 32-bit
zsh).

One problem is the PS1 of zsh.
It will display the same on both environment.
I'm wonder could I show different prompt inside the chroot environemnt?

If zsh's prompt variable can deal this?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to display zsh is 32/64 bit?
  2011-12-09  4:34 How to display zsh is 32/64 bit? Daniel Lin
@ 2011-12-09  8:04 ` Thomas Köhler
  2011-12-09  8:44   ` Daniel Lin
  2011-12-09 13:49 ` Peter Stephenson
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Köhler @ 2011-12-09  8:04 UTC (permalink / raw)
  To: Daniel Lin; +Cc: Bart Schaefer, Zsh Users

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

Hi Daniel,

Daniel Lin wrote:
> To do cross compile of 32/64 bit program on one machine.(which installed
> 64-bit zsh)
> I use ArchLinux x86_64 as host machine.
> And a arch32 chroot environment for 32-bit compiling(which installed 32-bit
> zsh).
> 
> One problem is the PS1 of zsh.
> It will display the same on both environment.
> I'm wonder could I show different prompt inside the chroot environemnt?
> 
> If zsh's prompt variable can deal this?

On Linux, you can simply do something like this:

PS1=$(file -L /proc/$$/exe | sed -e 's/.*ELF //' -e 's/-bit.*/ /')

On my 64 bit (debian derivative) system, that yields a PS1 of "64 ",
while in the 32 bit (debian) chroot, that yields a PS1 of "32 ".

Ciao,
Thomas

-- 
 Thomas Köhler       Email:       jean-luc@picard.franken.de
     <><             WWW:              http://gott-gehabt.de
                     IRC: tkoehler       Freenode: thkoehler
                     PGP public key available from Homepage!

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to display zsh is 32/64 bit?
  2011-12-09  8:04 ` Thomas Köhler
@ 2011-12-09  8:44   ` Daniel Lin
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Lin @ 2011-12-09  8:44 UTC (permalink / raw)
  To: Daniel Lin, Bart Schaefer, Zsh Users

[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]

Thanks, Thomas, it works.
But, because the 'file' utility is not installed on my arch32-light
environment.
So,
I use a more stupid method:
create a symbol file (eg. /opt/arch32/etc/pacman32.conf)

if [ -f /etc/pacm32.conf ] ; then
  PS1="32 "  // in arch32
else
  PS1="64 " // in arch64
fi

2011/12/9 Thomas Köhler <jean-luc@picard.franken.de>

> Hi Daniel,
>
> Daniel Lin wrote:
> > To do cross compile of 32/64 bit program on one machine.(which installed
> > 64-bit zsh)
> > I use ArchLinux x86_64 as host machine.
> > And a arch32 chroot environment for 32-bit compiling(which installed
> 32-bit
> > zsh).
> >
> > One problem is the PS1 of zsh.
> > It will display the same on both environment.
> > I'm wonder could I show different prompt inside the chroot environemnt?
> >
> > If zsh's prompt variable can deal this?
>
> On Linux, you can simply do something like this:
>
> PS1=$(file -L /proc/$$/exe | sed -e 's/.*ELF //' -e 's/-bit.*/ /')
>
> On my 64 bit (debian derivative) system, that yields a PS1 of "64 ",
> while in the 32 bit (debian) chroot, that yields a PS1 of "32 ".
>
> Ciao,
> Thomas
>
> --
>  Thomas Köhler       Email:       jean-luc@picard.franken.de
>     <><             WWW:              http://gott-gehabt.de
>                     IRC: tkoehler       Freenode: thkoehler
>                     PGP public key available from Homepage!
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
>
> iD8DBQFO4cETTEYXWMJlHuYRAlEIAJ4tsF/kY8Ldtt25rQFDOuOGNAf44ACffbMf
> WphBIFarW6FTf9X+TiV5Txk=
> =hQ4Q
> -----END PGP SIGNATURE-----
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to display zsh is 32/64 bit?
  2011-12-09  4:34 How to display zsh is 32/64 bit? Daniel Lin
  2011-12-09  8:04 ` Thomas Köhler
@ 2011-12-09 13:49 ` Peter Stephenson
  2011-12-09 15:38   ` Dan Nelson
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2011-12-09 13:49 UTC (permalink / raw)
  To: Zsh Users

On Fri, 9 Dec 2011 12:34:59 +0800
Daniel Lin <dlin.tw@gmail.com> wrote:
> To do cross compile of 32/64 bit program on one machine.(which installed
> 64-bit zsh)
> I use ArchLinux x86_64 as host machine.
> And a arch32 chroot environment for 32-bit compiling(which installed 32-bit
> zsh).
> 
> One problem is the PS1 of zsh.
> It will display the same on both environment.
> I'm wonder could I show different prompt inside the chroot environemnt?
> 
> If zsh's prompt variable can deal this?

I'm a bit suprised $MACHTYPE doesn't report it, but on a 64-bit RHEL
machine at work it was reporting i686, not x86_64.  This comes from
config.guess; I note ours is a bit out of date.  I've updated to the one
from automake 1.11.1 and it now reports x86_64 on that machine.  I'll
submit the newer config.guess and config.sub (they're not actually that new,
2009-11-20 instead of 2009-06=10).

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to display zsh is 32/64 bit?
  2011-12-09 13:49 ` Peter Stephenson
@ 2011-12-09 15:38   ` Dan Nelson
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Nelson @ 2011-12-09 15:38 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh Users

In the last episode (Dec 09), Peter Stephenson said:
> On Fri, 9 Dec 2011 12:34:59 +0800
> Daniel Lin <dlin.tw@gmail.com> wrote:
> > To do cross compile of 32/64 bit program on one machine.(which installed
> > 64-bit zsh) I use ArchLinux x86_64 as host machine.  And a arch32 chroot
> > environment for 32-bit compiling(which installed 32-bit zsh).
> > 
> > One problem is the PS1 of zsh.  It will display the same on both
> > environment.  I'm wonder could I show different prompt inside the chroot
> > environemnt?
> > 
> > If zsh's prompt variable can deal this?
> 
> I'm a bit suprised $MACHTYPE doesn't report it, but on a 64-bit RHEL
> machine at work it was reporting i686, not x86_64.  This comes from
> config.guess; I note ours is a bit out of date.  I've updated to the one
> from automake 1.11.1 and it now reports x86_64 on that machine.  I'll
> submit the newer config.guess and config.sub (they're not actually that
> new, 2009-11-20 instead of 2009-06=10).

SuSE has returned MACHTYPE=x86_64 on 64-bit machines for a long time, btw:

(root@chouse5) /root># echo $MACHTYPE
x86_64
(root@chouse5) /root># rpm -q zsh 
zsh-4.2.0-31.1
(root@chouse5) /root># ls -l /bin/zsh
-rwxr-xr-x  1 root root 559056 Jun 30  2004 /bin/zsh*
(root@chouse5) /root># cat /etc/SuSE-release 
SUSE LINUX Enterprise Server 9 (x86_64)
VERSION = 9
PATCHLEVEL = 3



-- 
	Dan Nelson
	dnelson@allantgroup.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-12-09 16:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-09  4:34 How to display zsh is 32/64 bit? Daniel Lin
2011-12-09  8:04 ` Thomas Köhler
2011-12-09  8:44   ` Daniel Lin
2011-12-09 13:49 ` Peter Stephenson
2011-12-09 15:38   ` Dan Nelson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).