blob: c5928508f350a720e992562018ce613f558abada (
plain)
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
|
#!/bin/bash
# install.sh
check_is_sudo() {
if [ "$EUID" -ne 0 ]; then
echo "Please run as root."
exit
fi
}
usage() {
echo "Usage: sudo bash install.sh [OPTION]"
echo " dotfiles - link all dotfiles"
echo " all - install all things listed above"
}
get_dotfiles() {
# create subshell
(
echo "--------- Get Dotfiles Now ---------"
cd "$HOME"
rm -rf .vimrc .tmux.conf .bashrc .zshrc .i3/config .emacs.d/init.el
ln -s .dotfiles/.vimrc .vimrc
ln -s .dotfiles/.tmux.conf .tmux.conf
ln -s .dotfiles/.bashrc .bashrc
ln -s .dotfiles/.zshrc .zshrc
ln -s .dotfiles/.emacs.d/init.el .emacs.d/init.el
ln -s .dotfiles/.i3/config .i3/config
)
}
main() {
local cmd=$1
if [[ -z "$cmd" ]]; then
usage
exit 1
fi
check_is_sudo
if [[ $cmd == all ]]; then
get_dotfiles
fi
}
main "$@"
|