-
Notifications
You must be signed in to change notification settings - Fork 95
/
setup.sh
executable file
·97 lines (80 loc) · 2.07 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
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
#!/bin/bash
#
# Set up computer environment
#
# Author: Nick Plekhanov, https://nikkhan.com/
# License: MIT
# https://github.com/nicksp/dotfiles
set -euo pipefail
cd "$(dirname $0)"
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
light_red=$(tput setaf 9)
bold=$(tput bold)
reset=$(tput sgr0)
title() {
echo "${bold}==> $1${reset}"
echo
}
warning() {
tput setaf 1
echo "/!\\ $1 /!\\"
tput sgr0
}
command_exists() {
command -v "$@" &> /dev/null
}
echo -e "
${yellow}
_ ._ _ , _ ._
(_ ' ( \` )_ .__)
( ( ( ) \`) ) _)
(__ (_ (_ . _) _) ,__)
~~\ ' . /~~
,::: ; ; :::,
':::::::::::::::'
____________/_ __ \____________
| |
| Welcome to @nicksp dotfiles |
|_______________________________|
"
echo
echo -e "${yellow}!!! ${red}WARNING${yellow} !!!"
echo -e "${light_red}This script will delete all your configuration files!"
echo -e "${light_red}Use it at your own risk."
if [ $# -ne 1 ] || [ "$1" != "-y" ]; then
echo -e "${yellow}Press Enter key to continue...${reset}\n"
read key
fi
# Backup existing zsh file
if [[ -e "$HOME/.zshrc" ]]; then
mv "$HOME/.zshrc" "$HOME/.zshrc.backup"
fi
# Use Touch ID to authorize sudo
if [ ! -f /etc/pam.d/sudo_local ]; then
title "🔒 Enabling Touch ID to authorize sudo commands..."
echo "auth sufficient pam_tid.so" | sudo tee /etc/pam.d/sudo_local
fi
# Ask for the administrator password upfront
warning "Activate sudo"
sudo echo "Sudo activated!"
echo
# Setup Zsh and register it as a default shell
title "🐚 Setting up Zsh..."
$HOME/dotfiles/setup/zsh.sh
echo
# Install Homebrew and packages/apps
title "🫖 Setting up Homebrew..."
$HOME/dotfiles/setup/brew.sh
echo
# Install Xcode, GitHub CLI & Node.js packages etc.
title "🚀 Setting up extra tools..."
$HOME/dotfiles/setup/misc.sh
echo
# Install dotfiles symlinks
title "🍤 Setting up symlinks..."
$HOME/dotfiles/setup/symlinks.sh
echo
echo "🦏 ${green}All done! Open a new terminal for the changes to take effect.${reset}"
$HOME/dotfiles/bin/nyan