[Buildd-tools-devel] schroot inquiry

Roger Leigh rleigh at whinlatter.ukfsn.org
Sat Apr 21 08:19:46 UTC 2007


Tim Freedom <tim_freedom at yahoo.com> writes:

(your message did get to the list, BTW.)

> I recently started using schroot yet there doesn't seem to be an easy
> way to tell if one is in a schroot "session" or not.  There are no
> environmental variables that get set (akin to SUDO_USER with sudo)
> and as such I haven't been able to modify my prompt to indicate that
> I'm schroot'ing.

One method is to check /etc/debian_chroot.  This will only exist
inside the chroot.  In fact, the bash shell automatically reads this
and adds it to the prompt:

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

It should be equally easy to set this for other shells.

> Could someone in the know please provide a work-around and possibly
> add or set a 'SCHROOT_USER' variable (or similar) when someone starts
> a SCHROOT shell.

We could certainly add such an environment variable.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20070421/0e16edc8/attachment.pgp


More information about the Buildd-tools-devel mailing list