/
install.sh
executable file
·82 lines (65 loc) · 2.08 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
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
### xcode installed, mac app store signed in warning
printf "⚠️ warning! this script requires you to be signed into the app store and
xcode to be installed\n"
read -n 1 -s -r -p "press any key to continue, ctrl+z to quit"
printf "\n"
### install Homebrew stuff
printf "setting up Homebrew\n"
# install brew if it's not installed
if test ! $(which brew); then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew update
brew tap homebrew/bundle
brew bundle
printf "brewing done\n"
###
### install macOS apps
printf "installing macOS apps\n"
mas install 413857545 # Divvy
###
### git completion
mkdir -p ~/.zsh && cd ~/.zsh
curl -o git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
curl -o _git https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh
[[ -f ~/.zcompdump ]] && rm ~/.zcompdump
###
### dotfile stuff
# symlink homedir to dotfiles in this repo
# https://github.com/michaeljsmalley/dotfiles/blob/master/makesymlinks.sh
# variables
dir=~/.dotfiles # dotfiles directory
olddir=~/.dotfiles/old # old dotfiles backup directory
cd "$(dirname "${BASH_SOURCE}")";
# create dotfiles_old
printf "backing up existing dotfiles in ~ to $olddir...\n"
mkdir -p $olddir
# back up & symlink files that start with a dot in ~/.dotfiles
cd $dir
shopt -s extglob
for f in .!(|.); do
# ignore git-related things that are specific to this repo
if [[ $f == ".git" || $f == ".gitignore" ]]; then
printf "ignoring $f\n"
continue
fi
# back up existing file, if it exists, then delete the link
printf "backing up ~/$f to $olddir\n"
if [[ -f ~/$f || -d ~/$f ]]; then
mv ~/$f $olddir
rm ~/$f
fi
# create symlink
printf "symlinking $dir/$f to ~/$f\n"
ln -s $dir/$f ~/$f
done
printf "dotfiles install done\n"
# add java versions to jenv
java_dir=/Library/Java/JavaVirtualMachines/
for version in ${java_dir}*/
do
java_version=${version}Contents/Home
jenv add $java_version
done
printf "jenv setup done\n"