-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·60 lines (47 loc) · 1.71 KB
/
install.sh
File metadata and controls
executable file
·60 lines (47 loc) · 1.71 KB
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
#!/usr/bin/env bash
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export BASEDIR
# Libs
# shellcheck source=libs/colors.sh
source "${BASEDIR}/libs/colors.sh"
set -e
[[ -x $(command -v wget) ]] && CMD="wget --no-check-certificate -O -"
[[ -x $(command -v curl) ]] >/dev/null 2>&1 && CMD="curl -#L"
function has_git() {
if [[ -x $(command -v git) ]]; then
if git --version >/dev/null 2>&1; then
return 0
fi
fi
return 1
}
if [ -z "${CMD}" ]; then
echo -e "${COLOR_RED}No curl or wget available. Aborting.${COLOR_END}"
else
echo -e "${COLOR_YELLOW}Installing dotfiles${COLOR_END}"
if has_git; then
echo -e "${COLOR_WHITE}Using Git to download scripts${COLOR_END}"
CMD="git clone --recursive https://github.com/meister/dotfiles ~/.dotfiles"
if [ -d ~/.dotfiles ]; then
if [ ! -d ~/.dotfiles/.git ]; then
mv ~/.dotfiles ~/.dotfiles_backup
echo "Backed up previous dotfiles to ~/.dotfiles_backup"
else
echo "Pulling updates to existing ~/.dotfiles"
CMD="(cd ~/.dotfiles && git pull --recurse-submodules)"
fi
fi
eval "${CMD}"
else
echo -e "${COLOR_WHITE}Using ${CMD} to download scripts${COLOR_END}"
if [ -d ~/.dotfiles ]; then
mv ~/.dotfiles ~/.dotfiles_backup
echo "Backed up previous dotfiles to ~/.dotfiles_backup"
fi
mkdir -p ~/.dotfiles
eval "${CMD} https://github.com/meister/dotfiles/tarball/master | tar -xzv -C ~/.dotfiles --strip-components=1 --exclude='{.gitignore}'"
eval "${CMD} https://github.com/zsh-users/antigen/tarball/master | tar -xzv -C ~/.dotfiles/antigen --strip-components=1 --exclude='{.gitignore}'"
fi
# shellcheck source=setup.sh
source ~/.dotfiles/setup.sh
fi