Print this page
OS-2051 serial console login should set TERM appropriately
Split |
Close |
Expand all |
Collapse all |
--- old/root/.bashrc
+++ new/root/.bashrc
1 1 if [ "$PS1" ]; then
2 + mt_tty=$(/usr/bin/tty 2>/dev/null)
3 + if [[ $mt_tty =~ ^/dev/term/[abcd] ]]; then
4 + # If we're on the serial console, we generally won't know how
5 + # big our terminal is. Attempt to ask it using control sequences
6 + # and resize our pty accordingly.
7 + mt_output=$(/usr/lib/measure_terminal 2>/dev/null)
8 + if [[ $? -eq 0 ]]; then
9 + eval "$mt_output"
10 + else
11 + # We could not read the size, but we should set a 'sane'
12 + # default as the dimensions of the previous user's terminal
13 + # persist on the tty device.
14 + export LINES=25
15 + export COLUMNS=80
16 + fi
17 + /usr/bin/stty rows ${LINES} columns ${COLUMNS} 2>/dev/null
18 + fi
19 + unset mt_output mt_tty
2 20 shopt -s checkwinsize
3 21 if [[ -f /.dcinfo ]]; then
4 22 . /.dcinfo
5 23 DC_NAME="${SDC_DATACENTER_NAME}"
6 24 DC_HEADNODE_ID="${SDC_DATACENTER_HEADNODE_ID}"
7 25 fi
8 26 if [[ -n "${DC_NAME}" && -n "${DC_HEADNODE_ID}" ]]; then
9 27 PS1="[\u@\h (${DC_NAME}:${DC_HEADNODE_ID}) \w]\\$ "
10 28 elif [[ -n "${DC_NAME}" ]]; then
11 29 PS1="[\u@\h (${DC_NAME}) \w]\\$ "
12 30 else
13 31 PS1="[\u@\h \w]\\$ "
14 32 fi
15 33 alias ll='ls -lF'
16 34 [ -n "${SSH_CLIENT}" ] && export PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME} \007" && history -a'
17 35 fi
18 36
19 37 # Load bash completion
20 38 [ -f /etc/bash/bash_completion ] && . /etc/bash/bash_completion
21 39
22 40 if [ "${TERM}" == "screen" ]; then
23 41 export TERM=xterm-color
24 42 fi
25 43
26 44 svclog() {
27 45 if [[ -z "$PAGER" ]]; then
28 46 PAGER=less
29 47 fi
30 48 $PAGER `svcs -L $1`
31 49 }
32 50
33 51 svclogf() {
34 52 /usr/bin/tail -f `svcs -L $1`
35 53 }
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX