-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·38 lines (30 loc) · 975 Bytes
/
install.sh
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
#!/bin/bash
set -ex
export dotfiles_home=${DOTFILES_HOME:-$HOME/.cfg}
export branch=${DOTFILES_BRANCH:-master}
config() {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
main() {
echo "Cloning from branch: $branch"
if [ -d $dotfiles_home ]; then
printf "Dotfiles already installed.\n"
fi
git clone --bare https://github.com/mazzma12/dotfiles.git --branch $branch $dotfiles_home
if config checkout; then
echo "Checked out config without conflicts.";
else
echo "Conflict with existing dotfiles. Backing up with .bak suffixes";
# Grab conflicting filenames and move them to {}.bak
config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv -v $HOME/{} $HOME/{}.bak
fi;
config checkout
config config status.showUntrackedFiles no
if which nvim >/dev/null 2>&1; then
nvim +slient +VimEnter +PlugInstall +qall > /dev/null
fi
if which vim >/dev/null 2>&1; then
vim +slient +VimEnter +PlugInstall +qall > /dev/null
fi
}
main