-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·101 lines (94 loc) · 3.03 KB
/
setup.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
#!/bin/bash
#########################################################################
# This setup script can be run with:
# > curl https://raw.githubusercontent.com/rynr/homedir/master/setup.sh | bash
#########################################################################
BASE_URL=https://raw.githubusercontent.com/rynr/homedir/master
PACKAGES="openssh-server
git gitk
vim
curl"
VIMPLUGINS="https://github.com/tpope/vim-fugitive
https://github.com/tpope/vim-rails
https://github.com/janx/vim-rubytest"
########################################################################
# Debian/Ubuntu
########################################################################
echo "Checking for sudo permission"
if sudo -l; then
echo -e "Sudo access is \e[32mavailable\033[0m"
else
echo -e "Sudo access is \e[31mnot available\033[0m"
echo "Please make sure sudo access is available .. exiting"
exit 1
fi
echo "Checking (and installing) some packages"
for package in $PACKAGES; do
echo -n "Checking for $package .."
if dpkg -V $package >>/dev/null 2>&1; then
echo -e " \e[32mOK\033[0m"
else
echo -n " installing .."
if sudo -n apt-get -q -y install $package; then
echo -e " \e[32mOK\033[0m"
else
echo -e " \e[31mfail\033[0m"
fi
fi
done
########################################################################
# Configure vim
########################################################################
echo "Checking (and installing) vim packages"
if [ ! -d $HOME/.vim/bundle ]; then mkdir -p $HOME/.vim/bundle; fi
if [ ! -d $HOME/.vim/autoload ]; then mkdir -p $HOME/.vim/autoload; fi
echo -e -n "Checking for vimrc .."
if [ -f $HOME/.vimrc ]; then
echo -e " \e[32mOK\033[0m"
else
echo -n " installing .."
if curl -s $BASE_URL/vimrc > $HOME/.vimrc; then
echo -e " \e[32mOK\033[0m"
else
echo -e " \e[31mfail\033[0m"
fi
fi
echo -e -n "Checking for pathogen .."
if [ -f $HOME/.vim/autoload/pathogen.vim ]; then
echo -e " \e[32mOK\033[0m"
else
echo -n " installing .."
if curl -s https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim > $HOME/.vim/autoload/pathogen.vim; then
echo -e " \e[32mOK\033[0m"
else
echo -e " \e[31mfail\033[0m"
fi
fi
for source in $VIMPLUGINS; do
package=`basename $source`
echo -e -n "Checking for $package .."
if [ -d $HOME/.vim/bundle/$package ]; then
echo -e " \e[32mOK\033[0m"
else
echo -n " installing .."
if git clone -q $source $HOME/.vim/bundle/$package; then
echo -e " \e[32mOK\033[0m"
else
echo -e " \e[31mfail\033[0m"
fi
fi
done
########################################################################
# Configure git
########################################################################
echo -e -n "Checking for gitconfig .."
if [ -f $HOME/.gitconfig ]; then
echo -e " \e[32mOK\033[0m"
else
echo -n " installing .."
if curl -s $BASE_URL/gitconfig > $HOME/.gitconfig; then
echo -e " \e[32mOK\033[0m"
else
echo -e " \e[31mfail\033[0m"
fi
fi