Skip to content

Commit a55dabd

Browse files
committed
initial
0 parents  commit a55dabd

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```
2+
curl https://gist.githubusercontent.com/zgulde/d46b3eb0cbbba4de19dcfbf4363a6de7/raw/357f7b29adb24393041de0ecfb1f4cc4b7003bf8/setup.sh | bash
3+
```

provision.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/bin/bash
2+
3+
# Setup script for codeup student's laptops
4+
5+
# 1. check for xcode, if it does not exist go ahead and install it
6+
# 2. do the same for brew
7+
# 3. if $HOME/.ssh/id_rsa does not exist, generate ssh keys and open github so
8+
# it can be configured there
9+
10+
wait-to-continue(){
11+
echo
12+
echo 'Press Enter to continue or Ctrl-C to exit'
13+
read
14+
}
15+
16+
install-xcode(){
17+
echo "We need to install some commandline tools for Xcode. When you press 'Enter',"
18+
echo "a dialog will pop up with several options. Click the 'Install' button and wait."
19+
echo "Once the process completes, come back here and we will proceed with the next step."
20+
wait-to-continue
21+
22+
xcode-select --install 2>&1
23+
24+
# wait for xcode...
25+
while sleep 1; do
26+
xcode-select --print-path >/dev/null 2>&1 && break
27+
done
28+
}
29+
30+
install-brew(){
31+
echo 'We are now going to install homebrew, a package manager for OSX.'
32+
wait-to-continue
33+
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
34+
}
35+
36+
setup-ssh-keys(){
37+
echo "We're now going to generate an SSH public/private key pair. This key is"
38+
echo "like a fingerprint for you on your laptop. We'll use this key for connecting"
39+
echo "to GitHub without having to enter a password."
40+
41+
echo "We will be putting a comment in the SSH key pair as well. Comments can be"
42+
echo "used to keep track of different keys on different servers. The comment"
43+
echo "will be formatted as [your name]@codeup."
44+
45+
while [ -z $NAME ]; do
46+
read -p 'Enter your name: ' NAME
47+
done
48+
49+
ssh-keygen -trsa -b2048 -C "$NAME@codeup" -f $HOME/.ssh/id_rsa -N ''
50+
51+
pbcopy < $HOME/.ssh/id_rsa.pub
52+
53+
echo "We've copied your ssh key to the clipboard for you. Now, we are going to take you"
54+
echo "to the GitHub website where you will add it as one of your keys by clicking the"
55+
echo "\"Add SSH key\" button and pasting the contents in there."
56+
57+
open https://github.com/settings/ssh
58+
59+
wait-to-continue
60+
}
61+
62+
echo 'We are going to check if xcode and brew are installed, and if you have ssh keys setup.'
63+
echo "If you don't see any output, then everything is good to go!"
64+
wait-to-continue
65+
66+
xcode-select --print-path >/dev/null 2>&1 || install-xcode
67+
68+
which brew >/dev/null 2>&1 || install-brew
69+
70+
[ -d $HOME/.ssh ] && [ -f $HOME/.ssh/id_rsa ] || setup-ssh-keys
71+
72+
echo "Ok! We've gotten everything setup and you should be ready to go!"
73+
echo "Good luck in class!"
74+
echo
75+
echo " _____ _____ _ _ "
76+
echo " | __ \\ / __ \\ | | | |"
77+
echo " | | \\/ ___ | / \\/ ___ __| | ___ _ _ _ __ | |"
78+
echo " | | __ / _ \\ | | / _ \\ / _ |/ _ \\ | | | '_ \\| |"
79+
echo " | |_\\ \\ (_) | | \\__/\\ (_) | (_| | __/ |_| | |_) |_|"
80+
echo " \\____/\\___/ \\____/\\___/ \\__,_|\\___|\\__,_| .__/(_)"
81+
echo " | | "
82+
echo " |_| "

0 commit comments

Comments
 (0)