-
Notifications
You must be signed in to change notification settings - Fork 7
/
install
executable file
·76 lines (65 loc) · 1.95 KB
/
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
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
73
74
75
76
#!/bin/bash
set -eu
test -d ${HOME:?The HOME env var is not set. wtaf}
if [[ ${1:-} == "init" ]]; then
echo "entering initial setup"
case ${OSTYPE:-unknown} in
(darwin*)
echo "running on a mac..."
;;
(freebsd*)
echo "running on a freebsd..."
;;
(linux*)
echo "running on a linux..."
DIST=$(lsb_release -si)
case ${DIST} in
(Ubuntu)
echo "ensuring required system packages are present..."
sudo apt-get update >/dev/null
sudo apt-get install -y >/dev/null \
libtime-hires-perl \
vim
;;
esac
;;
(*)
echo "*** UNRECOGNIZED SYSTEM (OSTYPE) FOUND: ${OSTYPE} ***"
;;
esac
fi
echo "setting up dot files in $HOME"
(
cd $HOME/env/dot
for FILE in *; do
cp $FILE $HOME/.$FILE
done
)
echo "configuring vim..."
mkdir -p $HOME/.vim
rsync -a vim/ $HOME/.vim/
echo "copying in $HOME/bin scripts..."
mkdir -p $HOME/bin $HOME/sw $HOME/code
cp $HOME/env/bin/* $HOME/bin
echo "configuring git..."
$HOME/env/git-config
echo "setting up $HOME/.bashrc..."
touch $HOME/.bashrc
grep -q "source $HOME/env/bashrc" $HOME/.bashrc || echo "source $HOME/env/bashrc" >> $HOME/.bashrc
set +eu
source $HOME/.bashrc
set -eu
if [[ ! -f $HOME/.bash_profile ]]; then
echo ". $HOME/.bashrc" > $HOME/.bash_profile
fi
if [[ -n ${IAMJAMESHUNT:-} || "${USER}" == "jhunt" || "${USER}" == "jrhunt" ]]; then
if [[ ! -f $HOME/.ssh/authorized_keys ]]; then
echo "setting up $HOME/.ssh/authorized_keys"
if [[ ! -d $HOME/.ssh ]]; then
mkdir -m 0700 $HOME/.ssh
fi
MAIN_PUBLIC="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzBc3qXx9fhO6lDtGCV8URDvzPt2WaKjpuWU6BtFKXCvsa0Y0S+Ej0Xn6CS7aEK8Cs0h0ZPm04Ye6XgOT2h/asHGcKvFfsEtUG2Y0tdLGx28WKsFfYb9UFYEqb258SyKYJIbmT9SI7K4wgD0wxri6bP3W7wdSqXC+vl7fU//XF98o/cv7gpUsENnEq15+0Ed40y5XKIzNqLUFGNWirBwW0OfjYCdXyfFnqd6xvtNfchOu7uRxdSDJ5rVsBHZWfCrxHzvz6Z2S7Ui8iJ1SmIckNhE6qYMccgvp1TggTZrO6baKMc8JSnO8ClWc9mLdEJiQHkCqDtrarnHEyk26UsqlV jhunt@MAIN"
echo "${MAIN_PUBLIC}" > $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
fi
fi