-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·85 lines (72 loc) · 2.11 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
83
84
85
#!/bin/zsh
# .dotfiles installation script for Mac OS X
base_dir=${0:a:h}
# Syntax:
#
# install file cmd regex
#
# Runs the install `cmd` for each line of the file, filtered with the `regex`
#
function install() {
install_file=$1
install_cmd=$2
install_regex=$3
while read line; do
id=`echo $line | sed -E "s/$install_regex|.*/\1/"`
cmd="$install_cmd $id"
eval ${cmd}
done <$install_file
}
function log() {
echo "|-----------------------------------------------------------------------"
echo "|"
echo "| $1"
echo "|"
}
# Backup default configuration
[ ! -f ~/.dotfiles/defaults.orig ] && defaults read > ~/.dotfiles/defaults.orig
# Enable FileVault
log "Enable FileVault"
sudo fdesetup enable
# Install brew
log "Install Homebrew"
if ! hash "brew"; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [ -d "/opt/homebrew" ]; then
HOMEBREW_HOME="/opt/homebrew"
else
HOMEBREW_HOME="/usr/local"
fi
eval "$($HOMEBREW_HOME/bin/brew shellenv)"
fi
# Install brew and taps
#/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
#brew tap homebrew/cask-fonts
#brew tap homebrew/cask-drivers
# Update brew
log "Update Homebrew"
brew update --force --quiet
brew upgrade
# Install software (see: README.md)
log "Install formulae"
install $base_dir/install/brew-list "brew install --formulae" "(.*)"
log "Install casks"
install $base_dir/install/brew-cask-list "brew install --cask --appdir=/Applications" "(.*)"
log "Install from App Store"
install $base_dir/install/mas-list "mas install" "([^ ]*).*"
# Cleanup
log "Cleanup Homebrew"
brew cleanup
# Reload quicklook (currently disabled)
#qlmanage -r
# Install Prezto
# Source: https://github.com/sorin-ionescu/prezto
log "Install Prezto"
if [[ ! -a "${ZDOTDIR:-$HOME}/.zprezto" ]]; then
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
fi
exit 0