-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·36 lines (30 loc) · 894 Bytes
/
install.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
#!/bin/sh
this=`readlink -f "$0"`
this_d=`dirname "$this"`
add_line_to() {
line="$1"
file="$2"
grep -qF -- "$line" "$file" || echo "$line" >> "$file"
}
add_link() {
from="$1"
to="$2"
if [ ! -e "$to" ]; then
ln -sr "$from" "$to" || exit 1
fi
}
add_line_to "# added by $0" "$HOME/.bashrc"
add_line_to "alias psg='ps -ef|grep'" "$HOME/.bashrc"
add_line_to "alias ll='ls -la'" "$HOME/.bashrc"
add_line_to "set -o vi" "$HOME/.bashrc"
add_line_to "PATH=~/bin:$PATH" "$HOME/.bashrc"
add_link "./gitconfig" "$HOME/.gitconfig"
add_link "./gvimrc" "$HOME/.gvimrc"
add_link "./vimrc" "$HOME/.vimrc"
add_link "./tmux.conf" "$HOME/.tmux.conf"
add_link "./bin" "$HOME/bin"
if [ ! -d "$HOME/.ssh" ]; then
mkdir -m 0700 "$HOME/.ssh" || exit 1
fi
add_link "./ssh-config" "$HOME/.ssh/config"
exit 0