-
Notifications
You must be signed in to change notification settings - Fork 7
/
setup
executable file
·77 lines (62 loc) · 1.65 KB
/
setup
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
#!/bin/bash
set -eu
cd "$(dirname $0)"
bold=$(tput bold)
green=$(tput setaf 2)
normal=$(tput sgr0)
title() {
echo "${bold}==> $1${normal}"
echo
}
indent() {
sed 's/^/ /'
}
echo
# Install brew
if test ! $(which brew); then
title "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [[ -d /home/linuxbrew/.linuxbrew ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
else
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
echo
fi
# Install brew packages
title "Installing software..."
brew bundle | indent
echo
# Ensure zsh is a valid shell option
if ! cat /etc/shells | grep $HOMEBREW_PREFIX/bin/zsh > /dev/null; then
title "Adding zsh to list of allowed shells..."
sudo sh -c "echo $HOMEBREW_PREFIX/bin/zsh >> /etc/shells"
echo
fi
# If macOS
if [[ "$(uname)" == "Darwin" ]]; then
# Use Touch ID for sudo
if [ ! -f /etc/pam.d/sudo_local ]; then
echo "auth sufficient pam_tid.so" | sudo tee /etc/pam.d/sudo_local
fi
title "Configuring macOS..."
./scripts/configure-macos
echo "Defaults configured!" | indent
echo
fi
# Install symlinks
title "Configuring software..."
./scripts/install-symlinks
# Check that we are using zsh
if [[ "$SHELL" != *"zsh"* ]]; then
if [[ "$(uname)" == "Darwin" ]]; then
title "Changing user shell to zsh..."
chsh -s $HOMEBREW_PREFIX/bin/zsh
echo "Your shell has been changed to zsh, please restart your terminal or tab" | indent
echo
else
echo "You are not using zsh, after installing, please run 'chsh -s /path/to/zsh'" | indent
echo
fi
fi
echo "${green}All done!${normal}" | indent