-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·153 lines (136 loc) · 3.23 KB
/
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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
function pull {
cd $DOTFILE_DIR
git pull origin master
git submodule init
git submodule update
# git submodule foreach git submodule update --init
# git submodule foreach update --init
}
function update {
if [ "$noUpdate" == 'false' ]; then
if [ "$autoUpdate" == 'true' ]; then
sudo apt-get install "$@"
elif [ "$autoUpdate" == 'false' ]; then
echo "Do you want to update $@"
read update
if [ "$update" == y ]; then
sudo apt-get install "$@"
fi
fi
fi
}
function link {
if [ "$forseLN" = 'true' ]; then
ln -sf $1 $2
else
if [[ -e "$2" ]]; then
echo "$2 already exists, if it is a symlink it will be deleted"
if [[ -h "$2" ]]; then
rm -rf "$2"
ln -s $1 $2
else
echo "Not a symlink, renaming and linking"
mv -f "$2" "$2_old"
ln -s $1 $2
fi
else
ln -s $1 $2
fi
fi
}
function installConfigs {
#ZSH
update zsh
echo "Installing ZSH Config"
link $DOTFILE_DIR/zsh ~/.zsh
link $DOTFILE_DIR/zsh/zshrc ~/.zshrc
link $DOTFILE_DIR/zsh/zshenv ~/.zshenv
if [ "$CI" == "false" ] && [ "$SHELL" != "/usr/bin/zsh" ]; then
chsh -s $(which zsh)
fi
echo ""
# #git
# update git
# echo "Installing Git Config"
# link $DOTFILE_DIR/git/gitconfig ~/.gitconfig
# link $DOTFILE_DIR/git/gitignore_global ~/.gitignore_global
# link $DOTFILE_DIR/git/gitattributes ~/.gitattributes
# echo ""
#Screen
update screen
echo "Installing Screen Config"
link $DOTFILE_DIR/screen/screenrc ~/.screenrc
echo ""
# Tmux
update tmux
echo "Installing Tmux Config"
link $DOTFILE_DIR/tmux/tmux.conf ~/.tmux.conf
echo ""
#SSH
update openssh-client
update openssh-server
echo "Installing SSH Config"
mkdir -p ~/.ssh/
link $DOTFILE_DIR/ssh/config ~/.ssh/config
echo ""
# #Gem
# update ruby-full
# echo "Installing Gem Config"
# link $DOTFILE_DIR/gem/gemrc ~/.gemrc
# echo Installing Rbenv
# git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
# git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
# echo ""
# if [[ -n "$XDG_CURRENT_DESKTOP" ]]; then
# #Sublime 3
# echo "Installing Sublime Text 3 Config"
# mkdir -p ~/.config/sublime-text-3/Packages/
# cd ~/.config/sublime-text-3/Packages/
# link $DOTFILE_DIR/sublimetext/User User
# echo ""
# fi
#VIM
update vim
echo "Installing VIM config"
link $DOTFILE_DIR/vim ~/.vim
link $DOTFILE_DIR/vim/vimrc ~/.vimrc
link ~/.vim ~/.config/nvim
link ~/.vimrc ~/.config/nvim/init.vim
vim +PluginInstall +qall
echo ""
# #Gradle
# echo "Installing Gradle Config"
# mkdir -p ~/.gradle/
# link $DOTFILE_DIR/gradle/gradle.properties ~/.gradle/gradle.properties
# echo ""
}
function main {
autoUpdate='false'
noLN='false'
forseLN='false'
noUpdate='false'
while getopts 'nufi' flag; do
case "${flag}" in
i) noUpdate='true' ;;
n) noLN='true' ;;
u) autoUpdate='true' ;;
f) forseLN='true' ;;
*) error "Unexpected option ${flag}" ;;
esac
done
if [ "$USER" == "travis" ]; then
CI='true'
DOTFILE_DIR="$(pwd)"
else
CI='false'
DOTFILE_DIR="$HOME/.dotfiles"
fi
if [ "$noLN" == 'true' ]; then
pull
elif [ "$noLN" == 'false' ]; then
pull
installConfigs
fi
}
main "$@"