Print this page
OS-2051 serial console login should set TERM appropriately
   1 if [ "$PS1" ]; then


















   2     shopt -s checkwinsize
   3     if [[ -f /.dcinfo ]]; then
   4         . /.dcinfo
   5         DC_NAME="${SDC_DATACENTER_NAME}"
   6         DC_HEADNODE_ID="${SDC_DATACENTER_HEADNODE_ID}"
   7     fi
   8     if [[ -n "${DC_NAME}" && -n "${DC_HEADNODE_ID}" ]]; then
   9        PS1="[\u@\h (${DC_NAME}:${DC_HEADNODE_ID}) \w]\\$ "
  10     elif [[ -n "${DC_NAME}" ]]; then
  11        PS1="[\u@\h (${DC_NAME}) \w]\\$ "
  12     else
  13        PS1="[\u@\h \w]\\$ "
  14     fi
  15     alias ll='ls -lF'
  16     [ -n "${SSH_CLIENT}" ] && export PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME} \007" && history -a'
  17 fi
  18 
  19 # Load bash completion
  20 [ -f /etc/bash/bash_completion ] && . /etc/bash/bash_completion
  21 
   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
  20     shopt -s checkwinsize
  21     if [[ -f /.dcinfo ]]; then
  22         . /.dcinfo
  23         DC_NAME="${SDC_DATACENTER_NAME}"
  24         DC_HEADNODE_ID="${SDC_DATACENTER_HEADNODE_ID}"
  25     fi
  26     if [[ -n "${DC_NAME}" && -n "${DC_HEADNODE_ID}" ]]; then
  27        PS1="[\u@\h (${DC_NAME}:${DC_HEADNODE_ID}) \w]\\$ "
  28     elif [[ -n "${DC_NAME}" ]]; then
  29        PS1="[\u@\h (${DC_NAME}) \w]\\$ "
  30     else
  31        PS1="[\u@\h \w]\\$ "
  32     fi
  33     alias ll='ls -lF'
  34     [ -n "${SSH_CLIENT}" ] && export PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME} \007" && history -a'
  35 fi
  36 
  37 # Load bash completion
  38 [ -f /etc/bash/bash_completion ] && . /etc/bash/bash_completion
  39