annotate .bash_profile @ 192:2dc3fbf65094

New aliases for "forcing" connections via ssh
author Steve Huston <huston@astro.princeton.edu>
date Mon, 21 Sep 2020 15:19:55 -0400
parents 315bbb06066a
children 6e7913283c7a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
f65964738bab Added Id tag to files, and svn propset svn:keywords as appropriate
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 16
diff changeset
1 # $Id$
f65964738bab Added Id tag to files, and svn propset svn:keywords as appropriate
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 16
diff changeset
2 #
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
3 # 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
4 # 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
5 # want to happen only on login shells should go here.
0
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
6
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
7 # Get the aliases and functions
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
8 if [ -f ~/.bashrc ]; then
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
9 . ~/.bashrc
0
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
10 fi
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
11
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
12 # User specific environment and startup programs
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
13
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
14 # 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
15 # 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
16 # export BASH_ENV=$HOME/.bashrc
0
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
17
7
1e8e782fccab Merge together the Linux and Darwin tests for the subversion status command,
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 6
diff changeset
18 # 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
19 # 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
20 # 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
21 # 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
22 # 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
23 # 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
24
0
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
25 #if [ "X$SSH_AUTH_SOCK" = "X" ] ; then
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
26 # eval `/usr/bin/ssh-agent`
0
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
27 #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
28
78
10c8cd44bf0a Changed 'svn' logic for monthly tests to 'hg'
Steve Huston <huston@srhuston.net>
parents: 76
diff changeset
29 # 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
30 # 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
31 # 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
32 # 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
33 # 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
34 # 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
35
1e8e782fccab Merge together the Linux and Darwin tests for the subversion status command,
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 6
diff changeset
36 [[ ! -f $HOME/.dotfilets || \
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
37 `eval $DFSTAT` -lt `eval $MDATE` ]] && {
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
38 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
39
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
40 # 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
41 case `hostname -s` in
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
42 bt)
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
43 echo
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
44 touch $HOME/.dotfilets
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
45 ;;
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
46
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
47 *)
78
10c8cd44bf0a Changed 'svn' logic for monthly tests to 'hg'
Steve Huston <huston@srhuston.net>
parents: 76
diff changeset
48 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
49 echo , running a status test.
78
10c8cd44bf0a Changed 'svn' logic for monthly tests to 'hg'
Steve Huston <huston@srhuston.net>
parents: 76
diff changeset
50 # 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
51 # 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
52 # upstream
83
c4dccb49471b HG tests changed
Steve Huston <huston@srhuston.net>
parents: 80
diff changeset
53 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
54 disown %+
61
d59d16a55494 * Added test to dotfile check which aborts if no keys loaded
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 33
diff changeset
55 else
d59d16a55494 * Added test to dotfile check which aborts if no keys loaded
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 33
diff changeset
56 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
57 fi
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 27
diff changeset
58 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
59 }
78
10c8cd44bf0a Changed 'svn' logic for monthly tests to 'hg'
Steve Huston <huston@srhuston.net>
parents: 76
diff changeset
60
10c8cd44bf0a Changed 'svn' logic for monthly tests to 'hg'
Steve Huston <huston@srhuston.net>
parents: 76
diff changeset
61 # 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
62 # 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
63 # 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
64 # directory is clean.
83
c4dccb49471b HG tests changed
Steve Huston <huston@srhuston.net>
parents: 80
diff changeset
65 if [ "`hg -q tip | sed 's/.*://'`" != "`hg -q id | sed 's/\+//'`" ] ; then
c4dccb49471b HG tests changed
Steve Huston <huston@srhuston.net>
parents: 80
diff changeset
66 echo Local repository contains updates.
c4dccb49471b HG tests changed
Steve Huston <huston@srhuston.net>
parents: 80
diff changeset
67 fi
c4dccb49471b HG tests changed
Steve Huston <huston@srhuston.net>
parents: 80
diff changeset
68 hg status
105
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
69
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
70 [[ $HOST == cake && "`tty`" == "/dev/tty1" ]] && {
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
71 # We're on the Raspberry Pi
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
72 export SDL_NOMOUSE=1
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
73 if [ ! -e /dev/input/js0 ] ; then
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
74 # PS3 controller isn't paired yet
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
75 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
76 (
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
77 trap break INT
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
78 for C in {1..30} ; do
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
79 sleep 1
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
80 if [ -e /dev/input/js0 ] ; then
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
81 break
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
82 fi
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
83 done
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
84 )
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
85 fi
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
86 clear
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
87 /usr/bin/emulationstation
3f1ead4ba8b4 Changes for the Pi:
Steve Huston <huston@astro.princeton.edu>
parents: 83
diff changeset
88 }