Typo fixes and Greek -> math unicode replacements in _Xmodmap.
[dotfiles-framework.git] / update.sh
1 #!/bin/bash
2 #
3 # Get the current dotfiles from the server using a variety of methods.
4 #
5 # In order of decreasing preference:
6 #   if we have git installed
7 #     git over ssh, if there is an ssh agent running
8 #     git over http
9 #   otherwise
10 #     wget a tarball
11
12 # The default ssh url is stored in .git/config, so we don't need it here
13 http="http://einstein.physics.drexel.edu/~wking/code/git/dotfiles.git"
14 tgz="http://einstein.physics.drexel.edu/~wking/code/tar/dotfiles.tgz"
15
16
17 # Check for Git (versioning system) so we know how to get our .dotfiles
18 if [ -d .git ];then
19    GIT_INSTALLED="true"
20 else
21    GIT_INSTALLED="false"
22 fi
23
24 # Check for a SSH agent
25 if [ -n "$SS_AUTH_SOCK" ] && [ -n "$SSH_AGENT_PID" ]; then
26    SSH_AGENT="true"
27 else
28    SSH_AGENT="false"
29 fi
30
31 if [ $GIT_INSTALLED == "true" ]; then
32     if [ $SSH_AGENT == "true" ]; then
33         git pull || exit 1
34     else
35         git pull $http master || exit 1
36     fi
37 else
38     # fallback on wgetting the tarball
39     pushd ~
40     wget --output-document dotfiles.tgz $tgz || exit 1
41     tar -xzvf dotfiles.tgz || exit 1
42     rm -rf dotfiles.tgz || exit 1
43     popd
44 fi