Mercurial > index.cgi > dotfiles
annotate .bash_profile @ 306:d55c28ab2879 default tip
Updated for new hosts on parapet
| author | Steve Huston <huston@princeton.edu> | 
|---|---|
| date | Wed, 16 Jul 2025 16:29:51 -0400 | 
| parents | 105ff650452c | 
| children | 
| rev | line source | 
|---|---|
| 1 
7e33b3191cf7
Merged in settings from home, and at the same time edited some of the
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
0diff
changeset | 1 # This file is sourced for interactive login shells, or | 
| 
7e33b3191cf7
Merged in settings from home, and at the same time edited some of the
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
0diff
changeset | 2 # non-interactive shells with the --login option. So things which you | 
| 
7e33b3191cf7
Merged in settings from home, and at the same time edited some of the
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
0diff
changeset | 3 # want to happen only on login shells should go here. | 
| 0 | 4 | 
| 5 # Get the aliases and functions | |
| 6 if [ -f ~/.bashrc ]; then | |
| 30 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 7 . ~/.bashrc | 
| 0 | 8 fi | 
| 9 | |
| 10 # User specific environment and startup programs | |
| 11 | |
| 1 
7e33b3191cf7
Merged in settings from home, and at the same time edited some of the
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
0diff
changeset | 12 # BASH_ENV is sourced for non-interactive shells; however, since we | 
| 
7e33b3191cf7
Merged in settings from home, and at the same time edited some of the
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
0diff
changeset | 13 # source ~/.bashrc above I don't think we have to here also. | 
| 
7e33b3191cf7
Merged in settings from home, and at the same time edited some of the
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
0diff
changeset | 14 # export BASH_ENV=$HOME/.bashrc | 
| 0 | 15 | 
| 7 
1e8e782fccab
Merge together the Linux and Darwin tests for the subversion status command,
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
6diff
changeset | 16 # These lines are helpful if you routinely might login without passing an | 
| 
1e8e782fccab
Merge together the Linux and Darwin tests for the subversion status command,
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
6diff
changeset | 17 # ssh-agent's authentication through. This way when you login, an agent is | 
| 
1e8e782fccab
Merge together the Linux and Darwin tests for the subversion status command,
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
6diff
changeset | 18 # exec'd for you (the corresponding lines in .bash_logout should kill the | 
| 
1e8e782fccab
Merge together the Linux and Darwin tests for the subversion status command,
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
6diff
changeset | 19 # agent when you logout, however they sometimes fail such as when killing your | 
| 
1e8e782fccab
Merge together the Linux and Darwin tests for the subversion status command,
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
6diff
changeset | 20 # shell without a proper logout or closing the connection). I left it here, | 
| 
1e8e782fccab
Merge together the Linux and Darwin tests for the subversion status command,
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
6diff
changeset | 21 # though I personally don't use/need it anymore. | 
| 
1e8e782fccab
Merge together the Linux and Darwin tests for the subversion status command,
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
6diff
changeset | 22 | 
| 0 | 23 #if [ "X$SSH_AUTH_SOCK" = "X" ] ; then | 
| 30 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 24 # eval `/usr/bin/ssh-agent` | 
| 0 | 25 #fi | 
| 6 
f5b253e17e34
Added test for .dotfilets, to check the status against the svn repo once per
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
1diff
changeset | 26 | 
| 78 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 27 # This part is quite useful if you have your dotfiles stored in version | 
| 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 28 # control (and it could be edited fairly easily for any version control system | 
| 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 29 # I'm sure). We check the timestamp of the file '$HOME/.dotfilets'. If it's | 
| 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 30 # older than a month, run a 'hg incoming' and touch it if nothing's changed; | 
| 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 31 # this way we check once per month to see if we forgot to pull down an updated | 
| 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 32 # version and keep getting reminders until we do. | 
| 7 
1e8e782fccab
Merge together the Linux and Darwin tests for the subversion status command,
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
6diff
changeset | 33 | 
| 
1e8e782fccab
Merge together the Linux and Darwin tests for the subversion status command,
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
6diff
changeset | 34 [[ ! -f $HOME/.dotfilets || \ | 
| 30 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 35 `eval $DFSTAT` -lt `eval $MDATE` ]] && { | 
| 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 36 echo -n Dotfiles last checked over a month ago | 
| 16 
b9896ae0733c
Stole pretty PS1 and xterm title changing from BackTrack 4.  Also added a
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
15diff
changeset | 37 | 
| 30 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 38 # Here we switch for hosts we don't want to check, just warn | 
| 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 39 case `hostname -s` in | 
| 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 40 bt) | 
| 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 41 echo | 
| 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 42 touch $HOME/.dotfilets | 
| 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 43 ;; | 
| 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 44 | 
| 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 45 *) | 
| 78 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 46 if ssh-add -l > /dev/null 2>&1 ; then | 
| 61 
d59d16a55494
* Added test to dotfile check which aborts if no keys loaded
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
33diff
changeset | 47 echo , running a status test. | 
| 78 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 48 # hg incoming returns 0 if there's changes, 1 if there isn't | 
| 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 49 # The goal will then be to only touch .dotfilets if there's no changes | 
| 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 50 # upstream | 
| 83 | 51 hg -q incoming || hg -q outgoing || touch $HOME/.dotfilets & | 
| 78 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 52 disown %+ | 
| 61 
d59d16a55494
* Added test to dotfile check which aborts if no keys loaded
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
33diff
changeset | 53 else | 
| 
d59d16a55494
* Added test to dotfile check which aborts if no keys loaded
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
33diff
changeset | 54 echo , but no keys loaded yet - add SSH keys and retrigger test. | 
| 
d59d16a55494
* Added test to dotfile check which aborts if no keys loaded
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
33diff
changeset | 55 fi | 
| 30 
ca6c77fe843b
* Whitespace (ugh)
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
27diff
changeset | 56 esac | 
| 7 
1e8e782fccab
Merge together the Linux and Darwin tests for the subversion status command,
 huston@80426f53-59d1-405d-934b-f07cd76f4a1a parents: 
6diff
changeset | 57 } | 
| 78 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 58 | 
| 
10c8cd44bf0a
Changed 'svn' logic for monthly tests to 'hg'
 Steve Huston <huston@srhuston.net> parents: 
76diff
changeset | 59 # Meanwhile, local changes are not costly and don't require a trip down the | 
| 79 
4a09583afaac
Do a checkout if there's nothing uncommitted
 Steve Huston <huston@srhuston.net> parents: 
78diff
changeset | 60 # network, so we can afford to run them any time. Make sure there's nothing | 
| 
4a09583afaac
Do a checkout if there's nothing uncommitted
 Steve Huston <huston@srhuston.net> parents: 
78diff
changeset | 61 # to pull from the local repository to the working directory and the working | 
| 
4a09583afaac
Do a checkout if there's nothing uncommitted
 Steve Huston <huston@srhuston.net> parents: 
78diff
changeset | 62 # directory is clean. | 
| 83 | 63 if [ "`hg -q tip | sed 's/.*://'`" != "`hg -q id | sed 's/\+//'`" ] ; then | 
| 251 
b00e6b403896
Added airline-colour-splits and removed whitespace
 Steve Huston <huston@srhuston.net> parents: 
198diff
changeset | 64 echo Local repository contains updates. | 
| 83 | 65 fi | 
| 66 hg status | |
| 105 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 67 | 
| 272 
105ff650452c
Renaming penguin -> sanctuary
 Steve Huston <huston@srhuston.net> parents: 
267diff
changeset | 68 [[ $HOST == sanctuary && -z "$SSH_AUTH_SOCK" ]] && { | 
| 254 
2bc70f7910fa
Let's set a sane default for the container on ChromeOS
 Steve Huston <huston@srhuston.net> parents: 
251diff
changeset | 69 # We're probably on a ChromeOS container with no ssh-agent running yet, so | 
| 
2bc70f7910fa
Let's set a sane default for the container on ChromeOS
 Steve Huston <huston@srhuston.net> parents: 
251diff
changeset | 70 # let's start one and exit when it ends. | 
| 267 
857bf32fbaab
Be a little chatty about what's going on just so I know
 Steve Huston <huston@srhuston.net> parents: 
254diff
changeset | 71 echo "Starting ssh-agent and a new shell" | 
| 254 
2bc70f7910fa
Let's set a sane default for the container on ChromeOS
 Steve Huston <huston@srhuston.net> parents: 
251diff
changeset | 72 ssh-agent bash | 
| 
2bc70f7910fa
Let's set a sane default for the container on ChromeOS
 Steve Huston <huston@srhuston.net> parents: 
251diff
changeset | 73 exit | 
| 
2bc70f7910fa
Let's set a sane default for the container on ChromeOS
 Steve Huston <huston@srhuston.net> parents: 
251diff
changeset | 74 } | 
| 
2bc70f7910fa
Let's set a sane default for the container on ChromeOS
 Steve Huston <huston@srhuston.net> parents: 
251diff
changeset | 75 | 
| 105 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 76 [[ $HOST == cake && "`tty`" == "/dev/tty1" ]] && { | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 77 # We're on the Raspberry Pi | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 78 export SDL_NOMOUSE=1 | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 79 if [ ! -e /dev/input/js0 ] ; then | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 80 # PS3 controller isn't paired yet | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 81 dialog --infobox "WARNING: PS3 controller not detected. Please press the PS button to pair. Ctrl-C on keyboard to skip." 4 55 | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 82 ( | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 83 trap break INT | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 84 for C in {1..30} ; do | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 85 sleep 1 | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 86 if [ -e /dev/input/js0 ] ; then | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 87 break | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 88 fi | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 89 done | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 90 ) | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 91 fi | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 92 clear | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 93 /usr/bin/emulationstation | 
| 
3f1ead4ba8b4
Changes for the Pi:
 Steve Huston <huston@astro.princeton.edu> parents: 
83diff
changeset | 94 } | 
