-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·50 lines (42 loc) · 1.35 KB
/
setup.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
#!/usr/bin/env bash
set -Eeuo pipefail
declare -r DOTFILES_REPO_URL="https://github.com/bjw-s-labs/dotfiles"
function get_os_type() {
uname
}
declare ostype="$(get_os_type)"
if [ "${ostype}" == "Darwin" ]; then
# Install XCode Command Line Tools if necessary
declare git_cmd_path="/Library/Developer/CommandLineTools/usr/bin/git"
if [ ! -e "${git_cmd_path}" ]; then
xcode-select --install
else
echo "Command line developer tools are already installed."
fi
# Install Homebrew if necessary
export HOMEBREW_CASK_OPTS=--no-quarantine
if which -s brew; then
echo "Homebrew is already installed."
else
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# Install chezmoi if necessary
if which -s chezmoi; then
echo "Chezmoi is already installed."
else
brew install chezmoi
fi
# Install 1Password if necessary
if which -s op; then
echo "1Password is already installed."
else
brew install --cask 1password
brew install 1password-cli
read -p "Please open 1Password, log into all accounts and set under Settings>CLI activate Integrate with 1Password CLI. Press any key to continue." -n 1 -r
fi
# Apply dotfiles
echo "Applying Chezmoi configuration."
chezmoi init bjw-s-labs/dotfiles
chezmoi apply
fi