-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
42 lines (37 loc) · 1012 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
#!/bin/bash
DOT_DIR="$HOME/dotfiles"
has() {
type "$1" > /dev/null 2>&1
}
if [ ! -d ${DOT_DIR} ]; then
if has "git"; then
git clone [email protected]:retact/dotfiles.git ${DOT_DIR}
elif has "curl" || has "wget"; then
TARBALL="https://github.com/retact/dotfiles/archive/main.tar.gz"
if has "curl"; then
curl -L ${TARBALL} -o main.tar.gz
else
wget ${TARBALL}
fi
tar -zxvf main.tar.gz
rm -f main.tar.gz
mv -f dotfiles-main "${DOT_DIR}"
else
echo "curl or wget or git required"
exit 1
fi
cd ${DOT_DIR}
for f in *;
do
[[ "$f" == ".git" ]] && continue
[[ "$f" == ".gitignore" ]] && continue
[[ "$f" == ".DS_Store" ]] && continue
[[ "$f" == "README.md" ]] && continue
[[ "$f" == "install.sh" ]] && continue
ln -snf $DOT_DIR/"$f" $HOME/".$f"
echo "Installed .$f"
done
else
echo "dotfiles already exists"
exit 1
fi