annotate .bash_profile @ 272:105ff650452c

Renaming penguin -> sanctuary
author Steve Huston <huston@srhuston.net>
date Thu, 25 Apr 2024 15:54:08 -0400
parents 857bf32fbaab
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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: 0
diff 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: 0
diff 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: 0
diff changeset
3 # want to happen only on login shells should go here.
0
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
4
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
5 # Get the aliases and functions
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
6 if [ -f ~/.bashrc ]; then
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
7 . ~/.bashrc
0
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
8 fi
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
9
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
10 # User specific environment and startup programs
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
11
1
7e33b3191cf7 Merged in settings from home, and at the same time edited some of the
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 0
diff 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: 0
diff 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: 0
diff changeset
14 # export BASH_ENV=$HOME/.bashrc
0
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
15
7
1e8e782fccab Merge together the Linux and Darwin tests for the subversion status command,
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 6
diff 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: 6
diff 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: 6
diff 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: 6
diff 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: 6
diff 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: 6
diff 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: 6
diff changeset
22
0
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
23 #if [ "X$SSH_AUTH_SOCK" = "X" ] ; then
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
24 # eval `/usr/bin/ssh-agent`
0
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
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: 1
diff changeset
26
78
10c8cd44bf0a Changed 'svn' logic for monthly tests to 'hg'
Steve Huston <huston@srhuston.net>
parents: 76
diff 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: 76
diff 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: 76
diff 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: 76
diff 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: 76
diff 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: 76
diff 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: 6
diff changeset
33
1e8e782fccab Merge together the Linux and Darwin tests for the subversion status command,
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 6
diff changeset
34 [[ ! -f $HOME/.dotfilets || \
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
35 `eval $DFSTAT` -lt `eval $MDATE` ]] && {
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff 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: 15
diff changeset
37
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff 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: 27
diff changeset
39 case `hostname -s` in
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
40 bt)
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
41 echo
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
42 touch $HOME/.dotfilets
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
43 ;;
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
44
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
45 *)
78
10c8cd44bf0a Changed 'svn' logic for monthly tests to 'hg'
Steve Huston <huston@srhuston.net>
parents: 76
diff 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: 33
diff changeset
47 echo , running a status test.
78
10c8cd44bf0a Changed 'svn' logic for monthly tests to 'hg'
Steve Huston <huston@srhuston.net>
parents: 76
diff 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: 76
diff 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: 76
diff changeset
50 # upstream
83
c4dccb49471b HG tests changed
Steve Huston <huston@srhuston.net>
parents: 80
diff changeset
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: 76
diff changeset
52 disown %+
61
d59d16a55494 * Added test to dotfile check which aborts if no keys loaded
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 33
diff changeset
53 else
d59d16a55494 * Added test to dotfile check which aborts if no keys loaded
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 33
diff 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: 33
diff changeset
55 fi
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
56 esac
7
1e8e782fccab Merge together the Linux and Darwin tests for the subversion status command,
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 6
diff changeset
57 }
78
10c8cd44bf0a Changed 'svn' logic for monthly tests to 'hg'
Steve Huston <huston@srhuston.net>
parents: 76
diff changeset
58
10c8cd44bf0a Changed 'svn' logic for monthly tests to 'hg'
Steve Huston <huston@srhuston.net>
parents: 76
diff 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: 78
diff 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: 78
diff 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: 78
diff changeset
62 # directory is clean.
83
c4dccb49471b HG tests changed
Steve Huston <huston@srhuston.net>
parents: 80
diff changeset
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: 198
diff changeset
64 echo Local repository contains updates.
83
c4dccb49471b HG tests changed
Steve Huston <huston@srhuston.net>
parents: 80
diff changeset
65 fi
c4dccb49471b HG tests changed
Steve Huston <huston@srhuston.net>
parents: 80
diff changeset
66 hg status
105
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
67
272
105ff650452c Renaming penguin -> sanctuary
Steve Huston <huston@srhuston.net>
parents: 267
diff 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: 251
diff 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: 251
diff 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: 254
diff 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: 251
diff changeset
72 ssh-agent bash
2bc70f7910fa Let's set a sane default for the container on ChromeOS
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
73 exit
2bc70f7910fa Let's set a sane default for the container on ChromeOS
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
74 }
2bc70f7910fa Let's set a sane default for the container on ChromeOS
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
75
105
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
76 [[ $HOST == cake && "`tty`" == "/dev/tty1" ]] && {
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
77 # We're on the Raspberry Pi
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
78 export SDL_NOMOUSE=1
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
79 if [ ! -e /dev/input/js0 ] ; then
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
80 # PS3 controller isn't paired yet
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff 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: 83
diff changeset
82 (
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
83 trap break INT
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
84 for C in {1..30} ; do
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
85 sleep 1
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
86 if [ -e /dev/input/js0 ] ; then
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
87 break
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
88 fi
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
89 done
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
90 )
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
91 fi
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
92 clear
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
93 /usr/bin/emulationstation
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
94 }