Add .fluxbox/keys.
[dotfiles-framework.git] / bin / fetch.sh
1 #!/bin/bash
2 #
3 # Get the current dotfiles from the server using a variety of methods.
4 #
5 # If there is a .git directory in $DOTFILES_DIR, use `git pull`,
6 # otherwise use wget to grab a tarball.
7
8 if [ -z "${DOTFILES_DIR}" ]; then
9     echo 'DOTFILES_DIR is not set.  Bailing out.'
10     exit 1
11 fi
12
13 cd "${DOTFILES_DIR}" || exit 1
14
15 # Check for Git (versioning system) so we know how to get our .dotfiles
16 if [ -d .git ];then
17     git pull || exit 1
18 else
19     # fallback on wgetting the tarball
20     if [ -z "${DOTFILES_TGZ}" ]; then
21         echo 'DOTFILES_TGZ is not set.  Bailing out.'
22         exit 1
23     fi
24     wget --output-document dotfiles.tgz "${DOTFILES_TGZ}" || exit 1
25     tar -xzvf dotfiles.tgz || exit 1
26     rm -rf dotfiles.tgz || exit 1
27 fi