Mercurial > index.cgi > dotfiles
comparison .bash_profile @ 7:1e8e782fccab
Merge together the Linux and Darwin tests for the subversion status command,
setting the proper commands as variables instead of hardcoding for each arch.
author | huston@80426f53-59d1-405d-934b-f07cd76f4a1a |
---|---|
date | Mon, 13 Apr 2009 03:38:53 +0000 |
parents | f5b253e17e34 |
children | 0f5a560c00d4 |
comparison
equal
deleted
inserted
replaced
6:f5b253e17e34 | 7:1e8e782fccab |
---|---|
12 | 12 |
13 # BASH_ENV is sourced for non-interactive shells; however, since we | 13 # BASH_ENV is sourced for non-interactive shells; however, since we |
14 # source ~/.bashrc above I don't think we have to here also. | 14 # source ~/.bashrc above I don't think we have to here also. |
15 # export BASH_ENV=$HOME/.bashrc | 15 # export BASH_ENV=$HOME/.bashrc |
16 | 16 |
17 # These lines are helpful if you routinely might login without passing an | |
18 # ssh-agent's authentication through. This way when you login, an agent is | |
19 # exec'd for you (the corresponding lines in .bash_logout should kill the | |
20 # agent when you logout, however they sometimes fail such as when killing your | |
21 # shell without a proper logout or closing the connection). I left it here, | |
22 # though I personally don't use/need it anymore. | |
23 | |
17 #if [ "X$SSH_AUTH_SOCK" = "X" ] ; then | 24 #if [ "X$SSH_AUTH_SOCK" = "X" ] ; then |
18 # eval `/usr/bin/ssh-agent` | 25 # eval `/usr/bin/ssh-agent` |
19 #fi | 26 #fi |
20 | 27 |
21 # Check timestamp of the file '$HOME/.dotfilets'. If it's older than a week, | 28 # This part is quite useful if you have your dotfiles stored in subversion |
22 # run a 'svn st -u' and touch it; this way we check once per week to see if we | 29 # (though it could be edited fairly easily for any other version control |
23 # forgot to pull down an updated version. I wish that command would change | 30 # system I'm sure). We check the timestamp of the file '$HOME/.dotfilets'. |
24 # its exit value based on if there's updates or not, would be easier to | 31 # If it's older than a week, run a 'svn st -u' and touch it; this way we check |
25 # automate this quietly. | 32 # once per week to see if we forgot to pull down an updated version. |
33 | |
34 # First set $STAT and $DATE since the syntax of the commands is different | |
35 # between Linux and Mac OS X. If this is run elsewhere, the eval will be | |
36 # false and the test not done below, so it's safe to not bother checking for | |
37 # zero-length variables on the test - it just won't run the svn status, so you | |
38 # won't be prompted if there's newer files available in your repository. | |
26 | 39 |
27 [[ `uname` == "Darwin" ]] && { | 40 [[ `uname` == "Darwin" ]] && { |
28 [[ ! -f $HOME/.dotfilets || \ | 41 STAT="stat -f %m -t %s $HOME/.dotfilets" |
29 `stat -f %m -t %s .dotfilets` -lt `date -v -1w +%s` ]] && { | 42 DATE="date -v -1w +%s" |
30 echo Dotfiles last checked over a week ago, running a status test. | |
31 svn st -u && touch $HOME/.dotfilets | |
32 } | |
33 } | 43 } |
34 | 44 |
35 [[ `uname` == "Linux" ]] && { | 45 [[ `uname` == "Linux" ]] && { |
36 # Linux tests here | 46 STAT="stat -c %Y $HOME/.dotfilets" |
47 DATE="date -d \"1 week ago\" +%s" | |
37 } | 48 } |
49 | |
50 [[ ! -f $HOME/.dotfilets || \ | |
51 `eval $STAT` -lt `eval $DATE` ]] && { | |
52 echo Dotfiles last checked over a week ago, running a status test. | |
53 echo Ctrl-C to abort, and test will be run again on next login. | |
54 svn st -u && touch $HOME/.dotfilets | |
55 } |