view .bash_profile @ 205:16fdb3931af6

Many changes to proxy setup, probably more to come eventually
author Steve Huston <huston@astro.princeton.edu>
date Tue, 24 Nov 2020 17:30:54 -0500
parents 6e7913283c7a
children b00e6b403896
line wrap: on
line source

# This file is sourced for interactive login shells, or
# non-interactive shells with the --login option.  So things which you
# want to happen only on login shells should go here.

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi

# User specific environment and startup programs

# BASH_ENV is sourced for non-interactive shells; however, since we
# source ~/.bashrc above I don't think we have to here also.
# export BASH_ENV=$HOME/.bashrc

# These lines are helpful if you routinely might login without passing an
# ssh-agent's authentication through.  This way when you login, an agent is
# exec'd for you (the corresponding lines in .bash_logout should kill the
# agent when you logout, however they sometimes fail such as when killing your
# shell without a proper logout or closing the connection).  I left it here,
# though I personally don't use/need it anymore.

#if [ "X$SSH_AUTH_SOCK" = "X" ] ; then
#  eval `/usr/bin/ssh-agent`
#fi

# This part is quite useful if you have your dotfiles stored in version
# control (and it could be edited fairly easily for any version control system
# I'm sure).  We check the timestamp of the file '$HOME/.dotfilets'.  If it's
# older than a month, run a 'hg incoming' and touch it if nothing's changed;
# this way we check once per month to see if we forgot to pull down an updated
# version and keep getting reminders until we do.

[[ ! -f $HOME/.dotfilets || \
  `eval $DFSTAT` -lt `eval $MDATE` ]] && {
  echo -n Dotfiles last checked over a month ago

  # Here we switch for hosts we don't want to check, just warn
  case `hostname -s` in
    bt)
      echo
      touch $HOME/.dotfilets
      ;;

    *)
      if ssh-add -l > /dev/null 2>&1 ; then
        echo , running a status test.
        # hg incoming returns 0 if there's changes, 1 if there isn't
        # The goal will then be to only touch .dotfilets if there's no changes
        # upstream
        hg -q incoming || hg -q outgoing || touch $HOME/.dotfilets &
        disown %+
      else
        echo , but no keys loaded yet - add SSH keys and retrigger test.
      fi
  esac
}

# Meanwhile, local changes are not costly and don't require a trip down the
# network, so we can afford to run them any time.  Make sure there's nothing
# to pull from the local repository to the working directory and the working
# directory is clean.
if [ "`hg -q tip | sed 's/.*://'`" != "`hg -q id | sed 's/\+//'`" ] ; then
  echo Local repository contains updates. 
fi
hg status

[[ $HOST == cake && "`tty`" == "/dev/tty1" ]] && {
  # We're on the Raspberry Pi
  export SDL_NOMOUSE=1
  if [ ! -e /dev/input/js0 ] ; then
    # PS3 controller isn't paired yet
    dialog --infobox "WARNING: PS3 controller not detected.  Please press the PS button to pair.  Ctrl-C on keyboard to skip." 4 55
    (
      trap break INT
      for C in {1..30} ; do
        sleep 1
          if [ -e /dev/input/js0 ] ; then
            break
          fi
      done
    )
  fi
  clear
  /usr/bin/emulationstation
}