-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·177 lines (135 loc) · 6.28 KB
/
install
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/usr/bin/env bash
################################################################################
# bootstrap
#
# This script is intended to set up a new Mac computer with my dotfiles and
# other development preferences.
################################################################################
# Thank you, thoughtbot!
bootstrap_echo() {
local fmt="$1"; shift
# shellcheck disable=SC2059
printf "\\n[BOOTSTRAP] $fmt\\n" "$@"
}
################################################################################
# VARIABLE DECLARATIONS
################################################################################
export COMMANDLINE_TOOLS="/Library/Developer/CommandLineTools"
export DEFAULT_SHELL="zsh"
osname=$(uname)
comp=$(scutil --get ComputerName)
host=$(scutil --get LocalHostName)
if [ -z "$comp" ] || [ -z "$host" ]; then
DEFAULT_COMPUTER_NAME="My Mac Computer"
DEFAULT_HOST_NAME="my-mac-computer"
else
DEFAULT_COMPUTER_NAME="$comp"
DEFAULT_HOST_NAME="$host"
fi
export DEFAULT_TIME_ZONE="Europe/Berlin"
################################################################################
# Make sure we're on a Mac before continuing
################################################################################
if [ "$osname" == "Linux" ]; then
bootstrap_echo "Oops, looks like you're on a Linux machine."
exit 1
elif [ "$osname" != "Darwin" ]; then
bootstrap_echo "Oops, it looks like you're using a non-UNIX system. This script
only supports Mac. Exiting..."
exit 1
fi
################################################################################
# Check for presence of command line tools if macOS
################################################################################
if [ ! -d "$COMMANDLINE_TOOLS" ]; then
bootstrap_echo "Apple's command line developer tools must be installed before
running this script. To install them, just run 'xcode-select --install' from
the terminal and then follow the prompts. Once the command line tools have been
installed, you can try running this script again."
exit 1
fi
################################################################################
# Authenticate
################################################################################
sudo -v
# Keep-alive: update existing `sudo` time stamp until bootstrap has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
set -e
################################################################################
# Welcome and setup
################################################################################
echo
echo "*************************************************************************"
echo "******* *******"
echo "******* Welcome to Mac Bootstrap! *******"
echo "******* *******"
echo "******* *******"
echo "*************************************************************************"
echo
printf "\\nEnter a name for your Mac. (Leave blank for default: %s)\\n" "$DEFAULT_COMPUTER_NAME"
read -r -p "> " COMPUTER_NAME
export COMPUTER_NAME=${COMPUTER_NAME:-$DEFAULT_COMPUTER_NAME}
export HOST_NAME=$OMPUTER_NAME
########################################
# prepare to install stuff from appstore
########################################
echo
read -p "Please signin in AppStore and press Enter..."
echo
# install and update brew
if test ! $(which brew); then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Update Homebrew recipes
brew update
# Install all our dependencies with bundle (See Brewfile)
brew tap homebrew/bundle
brew bundle --file macos/Brewfile
# Installing Oh-My-Zsh...
if [ -d "$HOME"/.oh-my-zsh ]; then
rm -rf "$HOME"/.oh-my-zsh
fi
echo "Clone oh-my-zsh"
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
echo "Clone Powerlevel10k"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k
# Install fonts
echo "[*] Downloading fonts if not exists (MesloLGS NF)..."
if [[ ! -e "$HOME/Library/Fonts/MesloLGS NF Regular.ttf" ]]; then
wget -q --show-progress -P $HOME/Library/Fonts/ https://github.com/romkatv/dotfiles-public/raw/master/.local/share/fonts/NerdFonts/MesloLGS%20NF%20Regular.ttf
fi
if [[ ! -e "$HOME/Library/Fonts/MesloLGS NF Bold.ttf" ]]; then
wget -q --show-progress -P $HOME/Library/Fonts/ https://github.com/romkatv/dotfiles-public/raw/master/.local/share/fonts/NerdFonts/MesloLGS%20NF%20Bold.ttf
fi
if [[ ! -e "$HOME/Library/Fonts/MesloLGS NF Italic.ttf" ]]; then
wget -q --show-progress -P $HOME/Library/Fonts/ https://github.com/romkatv/dotfiles-public/raw/master/.local/share/fonts/NerdFonts/MesloLGS%20NF%20Italic.ttf
fi
if [[ ! -e "$HOME/Library/Fonts/MesloLGS NF Bold Italic.ttf" ]]; then
wget -q --show-progress -P $HOME/Library/Fonts/ https://github.com/romkatv/dotfiles-public/raw/master/.local/share/fonts/NerdFonts/MesloLGS%20NF%20Bold%20Italic.ttf
fi
if [[ ! -e "$HOME/Library/Fonts/SourceCodePro+Powerline+Awesome+Regular.ttf" ]]; then
wget -q --show-progress -P $HOME/Library/Fonts/ https://github.com/Falkor/dotfiles/raw/master/fonts/SourceCodePro+Powerline+Awesome+Regular.ttf
fi
################################################################################
# Set macOS preferences
################################################################################
bootstrap_echo "Setting macOS preferences..."
# shellcheck source=/dev/null
source "macos/macos"
# Link .dotfiles
ln -sfn ~/.dotfiles/dotfiles/zshrc ~/.zshrc
ln -sfn ~/.dotfiles/dotfiles/p10k.zsh ~/.p10k.zsh
ln -sfn ~/.dotfiles/dotfiles/gitconfig ~/.gitconfig
# mOS 10.15 specific not nessesary anymore
#echo ""
#code
#read -p "Please open VSCode once and press Enter..."
#echo ""
code --install-extension almenon.arepl
code --install-extension batisteo.vscode-django
code --install-extension ms-azuretools.vscode-docker
code --install-extension ms-python.python
# Specify the preferences directory
defaults write com.googlecode.iterm2.plist PrefsCustomFolder -string "~/.dotfiles/iterm2"
# Tell iTerm2 to use the custom preferences in the directory
defaults write com.googlecode.iterm2.plist LoadPrefsFromCustomFolder -bool true