-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·115 lines (100 loc) · 2.52 KB
/
setup
File metadata and controls
executable file
·115 lines (100 loc) · 2.52 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
# copy from https://github.com/riobard/dotfiles/blob/master/setup
set -e
if [ ! -e ~/code ]; then
mkdir -p ~/code
fi
export DOTFILES_DIR=${HOME}/code/dotfiles
linkf() {
if [ -h ~/."$1" ]; then
if [ "$(readlink ~/."$1")" != "$DOTFILES_DIR"/home_root/"$1" ]; then
mv ~/."$1" ~/."$1".old
else
return 0
fi
elif [ -e ~/."$1" ]; then
mv ~/."$1" ~/."${1}".old
fi
ln -s "$DOTFILES_DIR"/home_root/"$1" ~/."$1"
echo home_root/"$1" linked
return 0
}
linkd() {
if [ -h ~/.config/"$1" ]; then
if [ "$(readlink ~/.config/"$1")" != "$DOTFILES_DIR"/config/"$1" ]; then
mv ~/.config/"$1" ~/.config/"$1".old
else
return 0
fi
elif [ -e ~/.config/"$1" ]; then
mv ~/.config/"$1" ~/.config/"$1".old
fi
ln -s "$DOTFILES_DIR"/config/"$1" ~/.config/
echo config/"$1" linked
return 0
}
linkroot() {
for i in "$DOTFILES_DIR"/home_root/*; do
if [ -e "$i" ]; then
linkf "$(basename "$i")"
fi
done
echo "files in home_root linked"
return 0
}
linkconfig() {
for i in $DOTFILES_DIR/config/*; do
if [ "$(basename "$i")" == "mimeapps.list" ]; then
continue;
fi
if [ -e "$i" ]; then
linkd "$(basename "$i")"
fi
done
echo "files in config linked"
return 0
}
clone() {
if ! [[ -d "$DOTFILES_DIR" ]]; then
git clone https://github.com/dgeibi/dotfiles.git "$DOTFILES_DIR"
else
cd "$DOTFILES_DIR"
git pull
fi
return 0
}
vim-plug() {
if ! [[ -e ~/.vim/autoload/plug.vim ]]; then
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
vim +PlugInstall +qa
return 0
}
installnvm() {
if ! [[ -e ~/.nvm ]]; then
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout "$(git describe --abbrev=0 --tags)"
. "$HOME"/.nvm/nvm.sh
nvm install "$(nvm ls-remote | tail -1 | tr -d ' ')"
cd -
fi
return 0
}
installgitcompletion() {
if [ ! -f ~/.git-completion.bash ]; then
curl -L http://git.io/vfhol > ~/.git-completion.bash
fi
return 0
}
installmimeappslist() {
if [ ! -f ~/.config/mimeapps.list ]; then
install -Dm644 "$DOTFILES_DIR"/config/mimeapps.list ~/.config/mimeapps.list
fi
return 0
}
clone
linkroot
linkconfig
installmimeappslist
vim-plug
# installnvm
installgitcompletion