-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathinstall.sh
executable file
·62 lines (57 loc) · 1.15 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
#!/usr/bin/env bash
set -e
ask() {
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
default=Y
elif [ "${2:-}" = "N" ]; then
prompt="y/N"
default=N
else
prompt="y/n"
default=
fi
read -p "$1 [$prompt] " REPLY </dev/tty
if [ -z "$REPLY" ]; then
REPLY=$default
fi
case "$REPLY" in
Y*|y*) return 0 ;;
N*|n*) return 1 ;;
esac
done
}
dir=`pwd`
if ask "Install symlink for .zshrc?" Y; then
ln -sf ${dir}/.zshrc ${HOME}/.zshrc
ln -sf ${dir}/.aliases.sh ${HOME}/.aliases.sh
fi
if ask "Install symlink for .config/nvim?" Y; then
ln -sfn ${dir}/.config/nvim ${HOME}/.config/nvim
fi
if ask "Install symlink for .tmux.conf?" Y; then
ln -sf ${dir}/.tmux.conf ${HOME}/.tmux.conf
fi
ask() {
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
default=Y
elif [ "${2:-}" = "N" ]; then
prompt="y/N"
default=N
else
prompt="y/n"
default=
fi
read -p "$1 [$prompt] " REPLY </dev/tty
if [ -z "$REPLY" ]; then
REPLY=$default
fi
case "$REPLY" in
Y*|y*) return 0 ;;
N*|n*) return 1 ;;
esac
done
}