-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·84 lines (76 loc) · 2.42 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·84 lines (76 loc) · 2.42 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
76
77
78
79
80
81
82
83
84
# if the bash profile link isn't there yet, make it
CMD="source ~/.bashrc"
if [ -f $HOME/.bash_profile ]; then
if ! fgrep -q -e "$CMD" "$HOME/.bash_profile"; then
printf "\n$CMD\n" >> $HOME/.bash_profile
fi
else
touch $HOME/.bash_profile
printf "\n$CMD\n" >> $HOME/.bash_profile
fi
# if the bashrc link isn't there yet, make it
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CMD="source $DIR/.bashrc"
if [ -f $HOME/.bashrc ]; then
if ! fgrep -q -e "$CMD" "$HOME/.bashrc"; then
# add $CMD to start of ~/.bashrc
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' $'1s#^#'"$CMD"$'\\\n#' $HOME/.bashrc
else
sed -i $'1s#^#'"$CMD"$'\\\n#' $HOME/.bashrc
fi
fi
else
touch $HOME/.bashrc
printf "$CMD\n" >> $HOME/.bashrc
fi
# if the bash history folder isn't there yet, make it
if [ ! -d "$HOME/.history_backups" ]; then
mkdir ~/.history_backups
fi
source ~/.bashrc
# Add the universal gitconfig from the repo to the computer's global settings
if [ -f ~/.gitconfig ]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' '/# Universal config/,/# Global config/d' $HOME/.gitconfig
else
sed -i '/# Universal config/,/# Global config/d' $HOME/.gitconfig
fi
\cp $HOME/.gitconfig .temp
printf "# Universal config\n" > ~/.gitconfig
cat $CONFIG_DIR/.gitconfig >> ~/.gitconfig
printf "\n# Global config\n" >> ~/.gitconfig
cat .temp >> ~/.gitconfig
\rm .temp
else
touch ~/.gitconfig
printf "# Universal config\n" > ~/.gitconfig
cat $CONFIG_DIR/.gitconfig >> ~/.gitconfig
printf "\n# Global config\n" >> ~/.gitconfig
fi
# Add the universal gitignore from the repo to the computer's global settings
if [ -f ~/.gitignore ]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' '/# Universal ignores/,/# Global ignores/d' $HOME/.gitignore
else
sed -i '/# Universal ignores/,/# Global ignores/d' $HOME/.gitignore
fi
\cp $HOME/.gitignore .temp
printf "# Universal ignores\n" > ~/.gitignore
cat $CONFIG_DIR/.gitignore >> ~/.gitignore
printf "\n# Global ignores\n" >> ~/.gitignore
cat .temp >> ~/.gitignore
\rm .temp
else
touch ~/.gitignore
printf "# Universal ignores\n" > ~/.gitignore
cat $CONFIG_DIR/.gitignore>> ~/.gitignore
printf "\n# Global ignores\n" >> ~/.gitignore
fi
# Copy the gittemplate
\cp $CONFIG_DIR/.gittemplate ~/.gittemplate
# Copy the inputrc
\cp $CONFIG_DIR/.inputrc ~/.inputrc
# Copy the githooks
\cp -r $CONFIG_DIR/.githooks/ ~
chmod +x ~/.githooks/*