aboutsummaryrefslogtreecommitdiff
path: root/deploy.sh
blob: f8b2f328768e33ffebca6350a5fc3e1b1bd3e3ce (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash

set -euo pipefail

# clean out old backups
rm -rf dotfiles-backup
mkdir -p dotfiles-backup

# XDG layout
xcache="${XDG_CACHE_HOME:-${HOME}/.cache}"
xdata="${XDG_DATA_HOME:-${HOME}/.local/share}"
xconfig="${XDG_CONFIG_HOME:-${HOME}/.config}"

userbin="$HOME/bin"

# deploy to XDG dirs
mkdir -p "${xcache}/zsh"
mkdir -p "${xdata}/zsh"
cd config
for d in *
do
    dest="${xconfig}/$d"
    if [ -e "$dest" ]; then
        mv "$dest" "../dotfiles-backup/$d"
    fi
    ln -sf "$(pwd)/$d" "$dest"
done
cd ..

# deploy to home
cd home
for f in *
do
    if [ -e "$HOME/.${f}" ]; then
        mv "$HOME/.${f}" "../dotfiles-backup/${f}"
    fi
    ln -sf "$(pwd)/${f}" "$HOME/.${f}"
done
cd ..

# deploy to user binaries
cd bin
for f in *
do
    if [ -e "$userbin/${f}" ]; then
        mv "$userbin/${f}" "../dotfiles-backup/${f}"
    fi
    ln -sf "$(pwd)/${f}" "$userbin/${f}"
done
cd ..

# install vundle for vim
if [ ! -d ~/.vim/bundle/vundle ]; then
    git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
    cd ~/.vim/bundle/vundle
    git pull
    cd -
fi
vim +BundleInstall +qall
vim +BundleClean +qall

# create local files
if [ ! -e ~/.config/zsh/00-local.zsh ]; then
    cp local/local.zsh config/zsh/00-local.zsh
fi
if [ ! -e ~/.config/git/config-local ]; then
    cp local/gitconfig-local config/git/config-local
fi
if [ ! -e ~/.local/share/fonts/sourcecodepro-nerd ]; then
    mkdir -p ~/.local/share/fonts/sourcecodepro-nerd
    unzip local/SourceCodePro.zip -d ~/.local/share/fonts/sourcecodepro-nerd
    echo "Run \'fc-cache -v\' to rebuild your font cache"
fi
if [ ! -e ~/.config/duplicity/config ]; then
    cp local/duplicity-config ~/.config/duplicity/config
fi
if [ ! -e ~/.config/duplicity/excludes ]; then
    cp local/duplicity-excludes ~/.config/duplicity/excludes
fi