-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·59 lines (53 loc) · 1.62 KB
/
install
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
#!/bin/bash
replace=""
[ -e 'gitconfig' ] && rm gitconfig
if [ -e 'gitconfig.user' ]; then
cat gitconfig.user >> gitconfig
else
echo "Create a gitconfig.user with just your own user details."
fi
cat gitconfig.withoutuser >> gitconfig
if [ ! -s $HOME/.oh-my-zsh ]; then
echo "time to get oh-my-zsh"
git clone --depth 1 git://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh
else
echo "oh my zsh already exists - skipping it"
fi
if [ ! -s $HOME/.rbenv ]; then
rbenv_path=$HOME/.rbenv
echo "time to get rbenv"
git clone --depth 1 git://github.com/sstephenson/rbenv.git $rbenv_path
git clone git://github.com/sstephenson/ruby-build.git $rbenv_path/plugins
else
echo "rbenv already exists - skipping it"
fi
for f in $(ls)
do
test $f = "install" && continue
test $f = "gitconfig.withoutuser" && continue
test $f = "gitconfig.user" && continue
test $f = "oh-my-zsh" && continue
test $f = "rbenv" && continue
dest="$HOME/.$f"
file="$PWD/$f"
if [ -e $dest ] || [ -h $dest ]; then
if [ "$replace" != "a" ]; then
echo "$dest already exists, replace? [y/n/a] "
read replace
fi
if [ "$replace" = "a" ] || [ "$replace" = "y" ]; then
echo "linking $file to $dest..."
rm -f $dest
ln -s $file $dest
test "$replace" != "a" && replace=""
else
echo "skipping $file as it already exists..."
fi
elif [ "$f" == "README" ]; then
echo "skipping README: $f."
else
echo "linking $file to $dest..."
ln -s $file $dest
fi
done
nano $HOME/.gitconfig