forked from gto76/my-linux-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-linux
More file actions
executable file
·76 lines (67 loc) · 2.21 KB
/
Copy pathinstall-linux
File metadata and controls
executable file
·76 lines (67 loc) · 2.21 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 script that creates simbolic links to the files of the repository.
# All links to the dotfiles are created in the home directory, except the
# config file of the .nrss directory, which is created if it doesent exist.
# All links to the text files are created in the ~/Desktop directory.
# Link is not created if file with same name already exists and warning is
# printed. Also line that loads .my_bashrc is added to the end of the .bashrc,
# if it doesen't exist yet. Similary the line that loads .my_vimrc is added
# to the end of .vimrc.
function createLink {
directory="$1"
file="$2"
fullPath="$directory"/"$file"
# Create directory if it doesent exist.
if [ ! -d "$directory" ]; then
echo "install.sh: Creating directory $directory."
mkdir -p "$directory"
fi
# Create link if file doesn't exist
if [[ ! -f "$fullPath" ]]; then
echo "install.sh: Creating link $fullPath"
ln -s `pwd`/"$file" "$fullPath"
else
echo "install.sh: WARNING: File $fullPath already exists. You will have to merge or overvrite it manualy."
fi
}
# create links to dotfiles
cd conf-files/linux
(cd bash
createLink ~ .my_bashrc
createLink ~ .my_bash_aliases
createLink ~ .my_bashrc_personal)
(cd vim
createLink ~ .my_vimrc
cd .vim/colors
createLink ~/.vim/colors github.vim
createLink ~/.vim/colors diner.vim
cd ../after/ftplugin
createLink ~/.vim/after/ftplugin python.vim)
(cd tmux
createLink ~ .tmux.conf)
(cd xmodmap
createLink ~ .Xmodmapus
createLink ~ .Xmodmapusvi
createLink ~ .Xmodmapsi
createLink ~ .Xmodmapsivi)
(cd nrss/.nrss
createLink ~/.nrss config)
cd ../..
# create links to textfiles
cd text-files
createLink ~/Desktop WTF-MAN
createLink ~/Desktop INS
createLink ~/Desktop NYK
cd ..
# add statement to .bashrc that will load .my_bashrc, if it doesent already exist
if [[ -z `grep ". ~/.my_bashrc" ~/.bashrc` ]]; then
echo "if [ -f ~/.my_bashrc ]; then" >> ~/.bashrc
echo " . ~/.my_bashrc" >> ~/.bashrc
echo "fi" >> ~/.bashrc
fi
# add statement to .vimrc that will load .my_vimrc, if it doesent already exist
if [[ -z `grep "so ~/.my_vimrc" ~/.vimrc` ]]; then
echo "so ~/.my_vimrc" >> ~/.vimrc
fi
# Install Vundle - vim plugin manager
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim