/
install.sh
executable file
·68 lines (55 loc) · 2.14 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
#!/bin/sh
echo "Last run: $(date)\n" >install.log
THIS_DIR="$(dirname "$(readlink -f "$0")")"
echo "\nDan's Mac Install Script"
echo "************************\n"
printf "Checking if Oh My Zsh is installed..."
if ! [ -d "$HOME/.oh-my-zsh" ]; then
printf " Not installed - installing..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" >>install.log 2>&1
echo " Done"
else
printf " Already installed - updating..."
zsh -ic "omz update" >>install.log 2>&1
echo " Done"
fi
printf "Checking if Homebrew is installed..."
if ! [ "$(command -v brew)" ]; then
printf " Not installed - installing (might prompt for sudo password)..."
sudo true
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" >>install.log 2>&1
echo " Done"
else
printf " Already installed - updating..."
brew update -q >>install.log 2>&1
echo " Done"
fi
printf "Installing / updating Homebrew packages..."
brew install -q python@3.11 git awscli nano nanorc ripgrep archey4 >>install.log 2>&1
brew upgrade -q >>install.log 2>&1
echo " Done"
printf "Installing / updating nvm..."
curl -s -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash >>install.log 2>&1
echo " Done"
printf "Linking / copying config files..."
ln -sF "$THIS_DIR/.zshrc" "$HOME/.zshrc"
cp -f "$THIS_DIR/.gitconfig" "$HOME/.gitconfig"
ln -sF "$THIS_DIR/.nanorc" "$HOME/.nanorc"
ln -sF "$THIS_DIR/.ssh/config" "$HOME/.ssh/config"
ln -sF "$THIS_DIR/.aws/config" "$HOME/.aws/config"
echo " Done"
printf "Checking for existence of SSH key..."
if ! [ -f "$HOME/.ssh/id_ed25519" ]; then
echo " Not found - creating..."
ssh-keygen -t ed25519 -f "$HOME/.ssh/id_ed25519" -N "" -C ""
echo " Done"
else echo " Already exists"; fi
printf "Adding SSH key to agent..."
ssh-add -q "$HOME/.ssh/id_ed25519"
echo " Done"
printf "Adding SSH key to Git signing configuration..."
echo "* $(<""$HOME""/.ssh/id_ed25519.pub)" >"$HOME/.ssh/allowed_signers"
git config --global user.signingkey "$(<""$HOME""/.ssh/id_ed25519.pub)"
echo " Done"
echo "\nScript complete! Reloading shell...\n"
zsh "$HOME/.zshrc"