-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·51 lines (39 loc) · 890 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
DOT_PATH=~/.dotfiles
GITHUB_URL=https://github.com/koooge/dotfiles
tarball=${GITHUB_URL}/archive/master.tar.gz
# get dotfiles from github
rm -rf $DOT_PATH
if type git > /dev/null 2>&1; then
git clone --recursive ${GITHUB_URL}.git $DOT_PATH
elif type wget > /dev/null 2>&1; then
wget -O - ${tarball} | tar zxv
mv -f dotfiles-master $DOT_PATH
elif type curl > /dev/null 2>&1; then
curl -L ${tarball} | tar zxv
mv -f dotfiles-master $DOT_PATH
else
echo "git, wget or curl required"
exit 1
fi
cd ~/.dotfiles
if [ $? -ne 0 ]; then
echo "not found: ${DOT_PATH}"
exit 1
fi
deploy() {
for f in .??*; do
[ "$f" = ".git" ] && continue
ln -snfv ${DOT_PATH}/${f} ${HOME}/${f}
done
}
initialize() {
: # TODO: implements
}
if [ "$1" = "deploy" -o "$1" = "d" ]; then
deploy
elif [ "$1" = "init" -o "$1" = "i" ]; then
initialize
else
deploy
fi