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 
  40 if [ "${TERM}" == "screen" ]; then
  41     export TERM=xterm-color
  42 fi
  43 
  44 svclog() {
  45   if [[ -z "$PAGER" ]]; then
  46     PAGER=less
  47   fi
  48   $PAGER `svcs -L $1`
  49 }
  50 
  51 svclogf() {
  52   /usr/bin/tail -f `svcs -L $1`
  53 }