-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·69 lines (61 loc) · 2.59 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env zsh
# shellcheck shell=bash
setopt pipefail
DOTFILES_DIRECTORY=$(cd "${0%/*}" && pwd -P)
MACOS=$(uname -a | grep -Fq Darwin 2>/dev/null && echo "MACOS" || echo "")
# Pre-requisites
# - Log in to iCloud
# - Install 1Password from App Store
# - Set up Internet Accounts
# - Install Homebrew
# Homebrew & App Store
echo -e "\033[1mSetting up Homebrew\033[0m"
[ -n "${MACOS}" ] && brew tap homebrew/bundle
[ -n "${MACOS}" ] && brew bundle --file Brewfile
[ -z "${CODESPACES}" ] && npm install --location=global --force npm@latest
mkdir -p "${HOME}/.gnupg" && chmod 700 "${HOME}/.gnupg" && echo "pinentry-program $(which pinentry-mac)" > "${HOME}/.gnupg/gpg-agent.conf"
echo -e "\033[1mHomebrew setup complete\033[0m\n"
# npm
echo -e "\033[1mSetting up npm\033[0m"
npm config set init-license "MIT"
npm config set init-author-email "clay@smockle.com"
npm config set init-author-name "Clay Miller"
npm config set init-author-url "https://www.smockle.com"
echo -e "\033[1mnpm setup complete\033[0m\n"
# vi
echo -e "\033[1mSetting up Vi\033[0m"
mkdir -p "${HOME}/.vim/backups"
mkdir -p "${HOME}/.vim/swaps"
mkdir -p "${HOME}/.vim/undo"
ln -fs "${DOTFILES_DIRECTORY}/.vimrc" "${HOME}/.vimrc"
echo -e "\033[1mVi setup complete\033[0m\n"
# git
echo -e "\033[1mSetting up Git\033[0m"
ln -fs "${DOTFILES_DIRECTORY}/.gitconfig" "${HOME}/.gitconfig"
ln -fs "${DOTFILES_DIRECTORY}/.gitignore" "${HOME}/.gitignore"
[ -n "${CODESPACES}" ] && git config --global "credential.helper" "cache" && git update-index --skip-worktree "${DOTFILES_DIRECTORY}/.gitconfig"
[ -n "${CODESPACES}" ] && [ -f "/usr/share/doc/git/contrib/diff-highlight/Makefile" ] && cd "/usr/share/doc/git/contrib/diff-highlight" && sudo make && sudo chown "$(whoami):" diff-highlight && chmod +x diff-highlight
whence -p diff-highlight &>/dev/null || git config --global "core.pager" "less --tabs=4 -RXE"
echo -e "\033[1mGit setup complete\033[0m\n"
# shell
echo -e "\033[1mSetting up Zsh\033[0m"
[ -n "${CODESPACES}" ] && sudo chsh -s "$(which zsh)" "$(whoami)"
ln -fs "${DOTFILES_DIRECTORY}/.zshrc" "${HOME}/.zshrc"
[ -n "${CODESPACES}" ] && ln -nfs "/workspaces" "${HOME}/Developer"
[ -n "${CODESPACES}" ] && [ ! -d "/workspaces/dotfiles" ] && ln -nfs "${DOTFILES_DIRECTORY}" "/workspaces/dotfiles"
echo -e "\033[1mZsh setup complete\033[0m\n"
# ssh
echo -e "\033[1mSetting up SSH\033[0m"
if [ ! -f "${HOME}/.ssh/config" ]; then
mkdir -p "${HOME}/.ssh"
tee "${HOME}/.ssh/config" << EOF
Host *
TCPKeepAlive yes
ServerAliveInterval 10
ServerAliveCountMax 10
ForwardAgent yes
AddKeysToAgent yes
UseKeychain yes
EOF
fi
echo -e "\033[1mSSH setup complete\033[0m\n"