-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·75 lines (64 loc) · 1.66 KB
/
setup.sh
File metadata and controls
executable file
·75 lines (64 loc) · 1.66 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
#!/bin/bash
install -d -m 755 ~/.bash/
DOT_FILES=(.bash_profile .bashrc .bashrc.aliases .bashrc.color .bashrc.env .bashrc.functions .gitconfig .profile .gitignore .bash_completion .tmux.conf .tigrc .greprc)
DOT_DIRS=(.lftp .bash_completion.d .ctags.d)
HOME_BREW_PKGS="bash-completion gawk bash coreutils gnu-sed"
# dotfiles
for file in ${DOT_FILES[@]}
do
if [[ -e $HOME/$file ]]
then
echo "File not found: $file"
continue
else
ln -s $HOME/dotfiles/$file $HOME/$file
fi
done
# dot directories (depth 1)
for dir in ${DOT_DIRS[@]}
do
mkdir -p $HOME/$dir
if [ "`uname`" == 'Linux' ]; then
files=$(find $HOME/dotfiles/$dir -maxdepth 1)
else
files=$(find $HOME/dotfiles/$dir -depth 1)
fi
for file in $files
do
fname=$(basename $file)
if [ ! -e $HOME/$dir/$fname ]
then
ln -s $file $HOME/$dir/$fname
fi
done
done
# Install utilities
if [ ! -e ~/bin/diff-highlight ]
then
curl https://raw.githubusercontent.com/git/git/v2.13.0/contrib/diff-highlight/diff-highlight > ~/bin/diff-highlight
chmod 755 ~/bin/diff-highlight
fi
if [ ! -e ~/.bash/git-completion.bash ]
then
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash > /tmp/git-completion.bash
install -m 755 /tmp/git-completion.bash ~/.bash/
fi
# HomeBrew
which brew 2>&1 > /dev/null
if [ $? == 0 ]
then
for pkg in $HOME_BREW_PKGS
do
if [ ! $(brew --prefix $pkg) ]
then
brew install $pkg
fi
done
fi
# Use bash version4
if [ -f /usr/local/bin/bash ]; then
sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
chsh -s /usr/local/bin/bash
fi
# Install bash completion files
bash ~/.bash_completion.d/install