-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·32 lines (28 loc) · 824 Bytes
/
install
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
#!/bin/bash -e
main() {
if [ -d "$HOME/.dotfiles" ]; then
read -r -p '~/dotfiles already exists on this system. Are you sure you want to continue? [y/n] ' INPUT
if [[ ! $INPUT =~ ^[Yy]$ ]]; then
exit 1
else
install
fi
fi
}
install() {
if ! [ -x "$(command -v git)" ]; then
curl -L https://github.com/nicolaballotta/dotfiles/archive/master.tar.gz -o "/tmp/dotfiles-master.tar.gz"
tar xzf "/tmp/dotfiles-master.tar.gz"
mv "/tmp/dotfiles-master" "$HOME/.dotfiles"
else
git clone --recursive https://github.com/nicolaballotta/dotfiles.git "$HOME/.dotfiles"
fi
if [ -d "$HOME/.dotfiles" ]; then
cd $HOME/.dotfiles
make all
else
printf '\033[31mERROR:\033[0m dotfiles either not downloaded or not extracted successfully\n' >&2
exit 1
fi
}
main