forked from je3f0o/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
55 lines (44 loc) · 1.08 KB
/
setup.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
52
53
54
55
#!/bin/bash
function __console_info {
echo -e "\x1b[36m[INFO] \x1b[32m$1\x1b[0m"
}
function __is_darwin {
[ `uname` == "Darwin" ]
}
# only for installing prefix
function __jeefo_info {
echo -e "\x1b[36m[INFO] \x1b[0mTrying to install \x1b[32m$@\x1b[0m"
}
function __jeefo_require_brew {
__is_darwin || return
local url=https://raw.githubusercontent.com/Homebrew/install/master/install.sh
brew --version &> /dev/null
if [ $? != 0 ]; then
__console_info 'Homebrew'
curl -fsSL $uurl
fi
}
function __jeefo_require_git {
git --version &> /dev/null
if [ $? != 0 ]; then
__console_info 'Git'
$(__is_darwin && brew install git || apt-get install git -y) || exit 1
fi
}
function __is_git {
git symbolic-ref --quiet HEAD &> /dev/null
[ $? -ne 128 ]
}
if __is_darwin; then
__jeefo_require_brew;
else
if [ $(id -u) != 0 ]; then
sudo echo hello > /dev/null
fi
fi
__jeefo_require_git;
mkdir -p ~/cloud/dotfiles && cd ~/cloud/dotfiles
if ! __is_git; then
git clone https://github.com/ariuk44/dotfiles.git . || echo exit 1
fi
source installer/setup.sh