-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·96 lines (82 loc) · 1.58 KB
/
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
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
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
if [ $# != 1 ]; then
echo 'missing number of arguments.'
echo 'correct number is 1.'
exit 1
fi
# ref: https://qiita.com/yudoufu/items/48cb6fb71e5b498b2532
# ghqで制御しているので、このファイルの実行ディレクトリをDOTFILESとする
DOTFILES=$(
cd $(dirname $0)
pwd
)
cd ~/
now=$(date '+%Y%m%d%H%M%S')
mkdir dotfile_history
function avoid_same_file() {
if [[ -e $1 ]]; then
mv $1 dotfile_history/$1_$now
fi
}
echo "update .gitconfig?[Y/n]"
read answer
case $answer in
[Yy]*)
avoid_same_file '.gitconfig'
ln -fs $DOTFILES/.gitconfig.$1 ./.gitconfig
;;
n) ;;
*)
echo -e "cannot understand $answer."
;;
esac
echo "update .gitconfig_global?[Y/n]"
read answer
case $answer in
[Yy]*)
avoid_same_file '.gitignore_global'
ln -fs $DOTFILES/.gitignore_global
;;
n) ;;
*)
echo -e "cannot understand $answer."
;;
esac
echo "update .zshrc?[Y/n]"
read answer
case $answer in
[Yy]*)
avoid_same_file '.zshrc'
avoid_same_file '.zshrc.base'
ln -fs $DOTFILES/.zshrc.base ./.zshrc.base
ln -fs $DOTFILES/.zshrc.$1 ./.zshrc
;;
n) ;;
*)
echo -e "cannot understand $answer."
;;
esac
echo "update .tmux_conf?[Y/n]"
read answer
case $answer in
[Yy]*)
avoid_same_file '.tmux.conf'
ln -fs $DOTFILES/.tmux.conf.$1 ./.tmux.conf
;;
n) ;;
*)
echo -e "cannot understand $answer."
;;
esac
echo "update .vimrc?[Y/n]"
read answer
case $answer in
[Yy]*)
avoid_same_file '.vimrc'
ln -fs $DOTFILES/.vimrc
;;
n) ;;
*)
echo -e "cannot understand $answer."
;;
esac