Re: [gentoo-user] Have portage lost its memory?

2006-03-25 Thread Walter Dnes
On Thu, Mar 23, 2006 at 02:36:18PM +0100, Toby 'qubit' Cubitt wrote

 I used to give the shell prompts different colours on different
 machines to help avoid this. Or rather, the local one would always be
 the same colour, but shells under ssh sessions were colour-coded by
 machine.
 
 I've lost the script I wrote for this somewhere in the mists of time
 (if I remember right, it was copied and hacked from a bash prompt
 example that colour-coded according to the login type: ssh, telnet,
 local, etc.)
 
 Someday I might get round to recreating it...

  As a basic reminder of which machine I'm on, I set the following...
export PS1='[\h][\u][\w]'

  On my main machine, an AMDK8 3000+, hostname is m3000, so the prompt
comes out as...
[m3000][waltdnes][~]

  My old, emergency backup, semi-retired 1999 Dell PIII 450 mhz machine
is named m450, so its prompt comes out as...
[m450][waltdnes][~]

  For a somewhat more colourful prompt, I now use...
export 
PS1='[\[\033[01;32m\]\h\[\033[00m\]][\[\033[01;34m\]\u\[\033[00m\]][\[\033[01;36m\]\w\[\033[00m\]]
 '

-- 
Walter Dnes [EMAIL PROTECTED] In linux /sbin/init is Job #1
My musings on technology and security at http://tech_sec.blog.ca
-- 
gentoo-user@gentoo.org mailing list



[gentoo-user] Have portage lost its memory?

2006-03-23 Thread Jules Colding
Hi,

Todays emerge --sync  emerge -vauDN world made me wonder a lot. 

A lot of packages should be updated according to portage, but a lot of
them seems to be wrong with regard to the reported version number. 

Take e.g. Evolution of which I have version 2.4.2.1 installed. Portage
is saying that I have version 2.2.3-r3 installed and that I should
update to 2.4.2.1:

[ebuild U ] mail-client/evolution-2.4.2.1 [2.2.3-r3] +crypt -dbus -debug 
-doc +gstreamer +ipv6 -kerberos -krb4 -ldap -mono -nntp -pda -profile +spell 
+ssl 11,233 kB

So what exactly is going on here?

Thanks,
  jules


-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Have portage lost its memory?

2006-03-23 Thread Jules Colding
On Thu, 2006-03-23 at 10:40 +0100, Jules Colding wrote:
 So what exactly is going on here?

Having an SSH session on another machine and forgetting ll about it.

Please forgive my stupidity here.

Sorry,
  jules



-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Have portage lost its memory?

2006-03-23 Thread Teresa and Dale
Jules Colding wrote:

On Thu, 2006-03-23 at 10:40 +0100, Jules Colding wrote:
  

So what exactly is going on here?



Having an SSH session on another machine and forgetting ll about it.

Please forgive my stupidity here.

Sorry,
  jules



  

I thought only I could do that.  Funny ain't it?

Dale
:-)
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Have portage lost its memory?

2006-03-23 Thread Jules Colding
On Thu, 2006-03-23 at 06:26 -0600, Teresa and Dale wrote:
 Jules Colding wrote:
 
 On Thu, 2006-03-23 at 10:40 +0100, Jules Colding wrote:
   
 
 So what exactly is going on here?
 
 
 
 Having an SSH session on another machine and forgetting ll about it.
 
 Please forgive my stupidity here.
 
 Sorry,
   jules
 
 I thought only I could do that.  Funny ain't it?

Not when you do it in public ;-)

-- 
  jules


-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Have portage lost its memory?

2006-03-23 Thread Toby 'qubit' Cubitt
On Thu, Mar 23, 2006 at 01:43:15PM +0100, Jules Colding wrote:
 On Thu, 2006-03-23 at 06:26 -0600, Teresa and Dale wrote:
  Jules Colding wrote:
  
  On Thu, 2006-03-23 at 10:40 +0100, Jules Colding wrote:

  
  So what exactly is going on here?
  
  
  
  Having an SSH session on another machine and forgetting ll about it.
  
  Please forgive my stupidity here.
  
  Sorry,
jules
  
  I thought only I could do that.  Funny ain't it?
 
 Not when you do it in public ;-)

I used to give the shell prompts different colours on different
machines to help avoid this. Or rather, the local one would always be
the same colour, but shells under ssh sessions were colour-coded by
machine.

I've lost the script I wrote for this somewhere in the mists of time
(if I remember right, it was copied and hacked from a bash prompt
example that colour-coded according to the login type: ssh, telnet,
local, etc.)

Someday I might get round to recreating it...

Toby
-- 
PhD Student
Quantum Information Theory group
Max Planck Institute for Quantum Optics
Garching, Germany

email: [EMAIL PROTECTED]
web: www.dr-qubit.org
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Have portage lost its memory?

2006-03-23 Thread Jules Colding
On Thu, 2006-03-23 at 14:36 +0100, Toby 'qubit' Cubitt wrote:
   Having an SSH session on another machine and forgetting ll about it.
   
   Please forgive my stupidity here.
   
   Sorry,
 jules
   
   I thought only I could do that.  Funny ain't it?
  
  Not when you do it in public ;-)
 
 I used to give the shell prompts different colours on different
 machines to help avoid this. Or rather, the local one would always be
 the same colour, but shells under ssh sessions were colour-coded by
 machine.
 
 I've lost the script I wrote for this somewhere in the mists of time
 (if I remember right, it was copied and hacked from a bash prompt
 example that colour-coded according to the login type: ssh, telnet,
 local, etc.)
 
 Someday I might get round to recreating it...

That would be helpful.

Best regards,
  jules



-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Have portage lost its memory?

2006-03-23 Thread Bo Andresen
On Thursday 23 March 2006 15:07, Jules Colding wrote:
  I used to give the shell prompts different colours on different
  machines to help avoid this. Or rather, the local one would always be
  the same colour, but shells under ssh sessions were colour-coded by
  machine.
 
  I've lost the script I wrote for this somewhere in the mists of time
  (if I remember right, it was copied and hacked from a bash prompt
  example that colour-coded according to the login type: ssh, telnet,
  local, etc.)
 
  Someday I might get round to recreating it...

 That would be helpful.

Here is an example that you could put in your .bashrc:

# Is this an ssh connection?
if [[ ! -z ${SSH_TTY} ]]; then
# Set prompt to \green([EMAIL PROTECTED]) \blue($PWD \$) green(..
PS1='\[\033[01;[EMAIL PROTECTED] \[\033[01;34m\]\w \$ \[\033[01;32m\]'
# Not an ssh connection
else
# Set prompt to \green([EMAIL PROTECTED]) \blue($PWD \$) black(..
PS1='\[\033[01;[EMAIL PROTECTED] \[\033[01;34m\]\w \$ \[\033[00m\]'
fi

If you want other colors or whatever refer to man console_codes.

-- 
Bo Andresen
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Have portage lost its memory?

2006-03-23 Thread alain . didierjean
Selon Toby 'qubit' Cubitt [EMAIL PROTECTED]:


 I used to give the shell prompts different colours on different
 machines to help avoid this. Or rather, the local one would always be
 the same colour, but shells under ssh sessions were colour-coded by
 machine.

 I've lost the script I wrote for this somewhere in the mists of time
 (if I remember right, it was copied and hacked from a bash prompt
 example that colour-coded according to the login type: ssh, telnet,
 local, etc.)

Here's one I use to make a difference between root (red prompt) and user
(green).
As for other stations, their prompt stays white. Hope it can help :

[ $UID -eq 0 ]  PS1=\e[1;[EMAIL PROTECTED] : \W \! # \e[0m || 
PS1=\e[1;[EMAIL PROTECTED] :
\W \! $ \e[0m

More readable version
if test $UID = 0 ; then
PS1=\e[31m\h:\w # \e[0m
else
PS1=[EMAIL PROTECTED]:\w \!\e[0m 
fi

-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Have portage lost its memory?

2006-03-23 Thread Toby 'qubit' Cubitt
On Thu, Mar 23, 2006 at 03:07:08PM +0100, Jules Colding wrote:
 On Thu, 2006-03-23 at 14:36 +0100, Toby 'qubit' Cubitt wrote:
Having an SSH session on another machine and forgetting ll about it.

Please forgive my stupidity here.

Sorry,
  jules

I thought only I could do that.  Funny ain't it?
   
   Not when you do it in public ;-)
  
  I used to give the shell prompts different colours on different
  machines to help avoid this. Or rather, the local one would always be
  the same colour, but shells under ssh sessions were colour-coded by
  machine.
  
  I've lost the script I wrote for this somewhere in the mists of time
  (if I remember right, it was copied and hacked from a bash prompt
  example that colour-coded according to the login type: ssh, telnet,
  local, etc.)
  
  Someday I might get round to recreating it...
 
 That would be helpful.


Here you go. It also checks if you're root. Save it as something
suitable somewhere in your $PATH, (e.g. ~/bin/bash_prompt), modify to
suit your setup, then do:

  source ~/bin/bash_prompt
  colour_code_prompt
  unset colour_code_prompt

either from the shell or in your .bashrc to load it.

Use at your own risk, since I've only just written it, and haven't
tested it very heavily! (When I've used it a bit to check it works
properly, I might document it a bit and put it on my web site.)

Toby


--
 bash_prompt:
--

#!/bin/bash

function colour_code_prompt
{
# set up some colour escape variables
BLUE=\[\033[1;34m\]
GREEN=\[\033[1;32m\]
CYAN=\[\033[1;36m\]
RED=\[\033[1;31m\]
MAGENTA=\[\033[1;35m\]
YELLOW=\[\033[1;33m\]
WHITE=\[\033[1;37m\]
GREY=\[\033[00m\]


# if logged in via ssh, choose colours according to host and user
if [ -n $SSH_CLIENT ]; then
if [ $EUID == 0 ]; then
case $(hostname -f) in
box1.some.domain)
COLOUR1=$RED
COLOUR2=$GREEN
;;
box2*)
COLOUR1=$RED
COLOUR2=$YELLOW
;;
*)
COLOUR1=$RED
COLOUR2=$MAGENTA
;;
esac

else
case $(hostname -f) in
box1.some.domain)
COLOUR1=$GREEN
COLOUR2=$CYAN
;;
box2*)
COLOUR1=$YELLOW
COLOUR2=$BLUE
;;
*.some.other.domain)
COLOUR1=$CYAN
COLOUR2=$RED
;;
*)
COLOUR1=$MAGENTA
COLOUR2=$BLUE
;;
esac
fi

# if logged in locally as root, use different colours
elif [ $EUID == 0 ]; then
COLOUR1=$RED
COLOUR2=$BLUE

# otherwise, use default colours
else
COLOUR1=$GREEN
COLOUR2=$BLUE
fi

# set the prompt
export PS1=[EMAIL PROTECTED] $COLOUR2\w \$ $GREY
}


-- 
PhD Student
Quantum Information Theory group
Max Planck Institute for Quantum Optics
Garching, Germany

email: [EMAIL PROTECTED]
web: www.dr-qubit.org
-- 
gentoo-user@gentoo.org mailing list