-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·72 lines (56 loc) · 1.39 KB
/
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
echo "THIS IS STILL A WIP SCRIPT!!!"
exit 1
function run() {
if [ -n $DRY_RUN ]; then
echo "[dry run]" $*
else
eval $*
fi
}
function run_on_dry() {
if [ -n $DRY_RUN ]; then
eval $*
fi
}
function warn() {
echo "[warn]" $*
}
function wait_enter() {
echo "Press [Enter] to continue:"
read
}
echo "Starting installation of Genki-S's environment..."
echo "Installing xcode tools..."
echo "While waiting, login to GitHub."
wait_enter
run open https://github.com/login
run xcode-select --install
echo "Generating SSH key pair..."
run ssh-keygen -t rsa
echo "Done. Copying id_rsa.pub to clipboard..."
run "cat ~/.ssh/id_rsa.pub | pbcopy"
echo "Done. Now add your ssh key"
wait_enter
run open https://github.com/settings/ssh
wait_enter
echo "Cloning Genki-S/dotfiles..."
run git clone [email protected]:Genki-S/dotfiles.git ~/dotfiles
echo "Done. chdir to dotfiles"
run cd ~/dotfiles
echo "Checking if you are a sudoer..."
run sudo -v
run is_sudoer=$?
run_on_dry is_sudoer=$(sudo -v; echo $?)
if [ $is_sudoer -ne 0 ]; then
warn "You are not a sudoer... will install homebrew in HOME directory."
run brew_prefix=$HOME
run_on_dry brew_prefix=$HOME
else
run brew_prefix=/usr/local
run_on_dry brew_prefix=/usr/local
fi
echo "Running rake install task..."
run BREW_PREFIX=$brew_prefix rake install
echo "Executing final setup task..."
run BREW_PREFIX=$brew_prefix rake bundle_up