Added auto-update to _bashrc. Currently UNTESTED.
authorW. Trevor King <wking@drexel.edu>
Wed, 26 Nov 2008 17:44:00 +0000 (12:44 -0500)
committerW. Trevor King <wking@drexel.edu>
Wed, 26 Nov 2008 17:44:00 +0000 (12:44 -0500)
Makefile
_bashrc

index f831f945184fe246fc618e12e298648ed135695e..be2eb95ab3ebd0b1818ab5e290828d193d1e144c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ fixup:
        ./fixup.sh
 
 update:
-       git pull
+       ./update.sh
 
 merge:
        ./merge.sh
diff --git a/_bashrc b/_bashrc
index f12e33969b40da38b5feb1cf958e3f9781fd1409..4abdf100c5a60cabf48619afee5fd5756a72ac55 100644 (file)
--- a/_bashrc
+++ b/_bashrc
@@ -156,3 +156,38 @@ if [ -z "$SSH_CLIENT" ]; then
        setterm -blength 0
     fi
 fi
+
+
+# Check for Git (versioning system) so we know how to get our .dotfiles
+GIT_PATH=`which git`
+if [ -n "GIT_PATH" ];then
+   GIT_INSTALLED="true"
+else
+   GIT_INSTALLED="false"
+fi
+
+# If we don't have checked out copies of our dotfiles, get them
+if [ ! -d ~/.dotfiles/ ]; then
+    if [ $GIT_INSTALLED == "true" ]; then
+        git clone http://einstein.physics.drexel.edu/~wking/code/git/dotfiles.git ~/.dotfiles
+    else
+        # fallback on wgetting the tarball
+        pushd ~
+       wget http://einstein.physics.drexel.edu/~wking/code/tar/dotfiles.tgz
+       tar -xzvf dotfiles.tgz
+       rm -rf dotfiles.tgz
+       popd
+    fi
+fi
+
+# If we have checked out copies of our dotfiles (i.e. clone successful)
+if [ -d ~/.dotfiles/ ]; then
+    # Update once a week from our remote repository.
+    if [ ! -e ~/.dotfiles/updated.`date +%U` ]; then
+        rm -f ~/.dotfiles/updated.* 2>/dev/null
+        touch ~/.dotfiles/updated.`date +%U`
+        pushd ~/.dotfiles
+        make update
+        popd
+    fi
+fi