-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·58 lines (49 loc) · 1.35 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·58 lines (49 loc) · 1.35 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
#!/bin/bash
# Get the absolute path of the dotfiles
oldpath="$PWD"
cd $(dirname "$0")
path="$PWD"
cd "$OLDPATH"
no_all=false
if [ "$1" == "-n" ]; then
no_all=true
fi
function append_into() {
if test -e "$2" && $(grep -q "$1" "$2"); then
echo "Already sourced, skipping: $1 -> $2"
return 1
fi
echo "Adding source: $1 -> $2"
echo "$1" >> "$2"
}
function copy() {
if test -e "$2"; then
if $no_all; then
echo "Skipping: $2"
return
fi
read -n1 -p "Target '$2' already exists, overwrite? [y/N] " r
if [ "$r" != "" ]; then
echo ""
fi
if [ "$r" != "y" ]; then
return
fi
fi;
echo "Copying: $1 -> $2"
cp -r "$1" "$2"
}
append_into "export DOTFILES_PATH=$path" ~/.bash_profile #shouldn't this get put in .bashrc -> want the path updated for each terminal opened...
append_into ". $path/.bash_aliases" ~/.bash_aliases
#append_into ". $path/.bash_profile" ~/.bash_profile
#append_into ". $path/.bashrc" ~/.bashrc
#copy "$path/local" ~/local
copy "$path/.gitconfig" ~/.gitconfig
#copy "$path/.gvimrc" ~/.gvimrc
#copy "$path/.screenrc" ~/.screenrc
#copy "$path/.vim" ~/.vim
copy "$path/.vimrc" ~/.vimrc
if [ "$(uname)" == "Darwin" ]; then
append_into ". ~/.bash_profile" ~/.profile
append_into ". ~/.bashrc" ~/.bash_profile
fi