Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] [PATCH] modules/generic_target.py: Pass TERM through to the chroot environment
Date: Tue, 31 Dec 2013 10:09:45
Message-Id: 1388484556.24088.102.camel@big_daddy.dol-sen.ca
In Reply to: [gentoo-catalyst] [PATCH] modules/generic_target.py: Pass TERM through to the chroot environment by "W. Trevor King"
1 On Sat, 2013-12-28 at 18:55 -0800, W. Trevor King wrote:
2 > From: "W. Trevor King" <wking@×××××××.us>
3 >
4 > Avoid:
5 >
6 > Running stage1-chroot.sh in chroot /var/tmp/catalyst/tmp/default/...
7 > tput: No value for $TERM and no -T specified
8 >
9 > by passing the caller's TERM environment variable [1] through to the
10 > chroot. If the caller does not supply TERM, default to 'dumb' which
11 > disables color etc., but should be the most portable. On Gentoo, the
12 > dumb terminfo (/usr/share/terminfo/d/dumb) is distributed as part of
13 > ncurses [2]. You can list supported terminals with toe, which is also
14 > distributed with ncurses [2]:
15 >
16 > $ toe
17 > ansi ansi/pc-term compatible with color
18 > dumb 80-column dumb tty
19 > linux linux console
20 > ...
21 >
22 > [1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
23 > [2]: http://www.gnu.org/software/ncurses/
24 > ---
25 > modules/generic_target.py | 8 ++++++--
26 > 1 file changed, 6 insertions(+), 2 deletions(-)
27 >
28 > diff --git a/modules/generic_target.py b/modules/generic_target.py
29 > index fe96bd7..30dadc8 100644
30 > --- a/modules/generic_target.py
31 > +++ b/modules/generic_target.py
32 > @@ -1,3 +1,5 @@
33 > +import os
34 > +
35 > from catalyst_support import *
36 >
37 > class generic_target:
38 > @@ -7,5 +9,7 @@ class generic_target:
39 > def __init__(self,myspec,addlargs):
40 > addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
41 > self.settings=myspec
42 > - self.env={}
43 > - self.env["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
44 > + self.env = {
45 > + 'PATH': '/bin:/sbin:/usr/bin:/usr/sbin',
46 > + 'TERM': os.getenv('TERM', 'dumb'),
47 > + }
48
49 Hand applied to the 3.0 branch. Works like a charm :)
50
51 Also will be pushed in the morning after a bit more testing which is in
52 progress.

Attachments

File name MIME type
signature.asc application/pgp-signature