-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·62 lines (53 loc) · 1.57 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
#!/bin/sh
# Only run on first install
if [ ! -d "$HOME/.dotfiles" ]; then
echo "Installing andreazevedo/dotfiles for the first time."
echo "Installing dependencies."
if hash brew 2> /dev/null; then
brew update
brew install git cmake macvim clang-format
elif hash apt-get 2> /dev/null; then
sudo apt-get update
sudo apt-get install git cmake build-essential python-dev clang-format python3-dev
elif hash yum 2> /dev/null; then
sudo yum install git cmake gcc clang python3-devel cmake3
fi
git clone https://github.com/andreazevedo/dotfiles.git "$HOME/.dotfiles"
cd "$HOME/.dotfiles"
fi
# Install bashrc
if [ -f "$HOME/.bashrc" ]; then
if [ -f "$HOME/.bashrc.bkp" ]; then
rm -f "$HOME/.bashrc.bkp"
fi
mv "$HOME/.bashrc" "$HOME/.bashrc.bkp"
fi
echo source \$HOME/.dotfiles/bashrc > $HOME/.bashrc
# Install gitconfig
if [ -f "$HOME/.gitconfig" ]; then
if [ -f "$HOME/.gitconfig.bkp" ]; then
rm -f "$HOME/.gitconfig.bkp"
fi
mv "$HOME/.gitconfig" "$HOME/.gitconfig.bkp"
fi
echo "[include]
path = ~/.dotfiles/gitconfig" > $HOME/.gitconfig
# Install hgrc
if [ -f "$HOME/.hgrc" ]; then
if [ -f "$HOME/.hgrc.bkp" ]; then
rm -f "$HOME/.hgrc.bkp"
fi
cp "$HOME/.hgrc" "$HOME/.hgrc.bkp"
fi
echo "
%include ~/.dotfiles/mercurial/hgrc" >> $HOME/.hgrc
# Install tmux.conf
if [ -f "$HOME/.tmux.conf" ]; then
if [ -f "$HOME/.tmux.conf.bkp" ]; then
rm -f "$HOME/.tmux.conf.bkp"
fi
mv "$HOME/.tmux.conf" "$HOME/.tmux.conf.bkp"
fi
echo source \$HOME/.dotfiles/tmux.conf > $HOME/.tmux.conf
# Finishing
echo "dotfiles installed successfully!"