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]\\$ "
↓ open down ↓ 24 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX