forked from abraxas/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-dotfiles
executable file
·47 lines (39 loc) · 1003 Bytes
/
install-dotfiles
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
set -e
if [ "$(basename "$0")" != install-dotfiles ]; then
if ! which git >/dev/null; then
echo "Please install git first" 1>&2
exit 1
fi
if [ ! -d "$HOME/.dotfiles" ]; then
echo "Downloading dotfiles..."
git clone "https://bitbucket.org/icecom/dotfiles.git" "$HOME/.dotfiles"
fi
cd
exec "$HOME/.dotfiles/install-dotfiles"
fi
dotfiles="
gitconfig
gitignore
ackrc
pylintrc
zshrc
zprompt
zsh.d
tmux.conf
"
dotfiles_dir=".dotfiles"
cd $HOME
for df in $dotfiles; do
source="$dotfiles_dir/$df"
target=".$df"
if [ $target != "$(basename $target)" -a ! -e "$(dirname $target)" ]; then
echo "Creating directories \"$(dirname $target)\""
mkdir -p "$(dirname $target)"
fi
if [ ! -L $target -o "$(readlink $target)" != "$source" ]; then
[ -e $target -o -L $target ] && rm $target
echo "Linking $source to $target"
ln -s $source $target
fi
done