-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup
executable file
·74 lines (58 loc) · 1.97 KB
/
setup
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
#!/usr/bin/env bash
DOTFILES_DIR=~/dotfiles
STOW_FILES_HOME=("bat" "fzf" "git" "gnupg" "npm" "ripgrep" "starship" "tmux" "vim" "zsh")
STOW_FILES_XDG=("ghostty" "zed")
# Install Homebrew
if [ ! -f /opt/homebrew/bin/brew ]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew tap homebrew/bundle
fi
# Clone the repository into the dotfiles dir
if [ ! -d $DOTFILES_DIR ]; then
git clone https://github.com/diegoholiveira/dotfiles.git $DOTFILES_DIR
fi
# Configure nord-dircolors
if [ ! -f ~/.dir_colors ]; then
curl -sSkLo ~/.dir_colors https://raw.githubusercontent.com/arcticicestudio/nord-dircolors/develop/src/dir_colors
fi
sudo chmod -R 755 /opt/homebrew/share
sudo chown -R $(whoami):admin /opt/homebrew/share
# Install all dependencies using the Brewfile
(
if [ ! -d /usr/local/sbin ]; then
sudo mkdir -p /usr/local/sbin || true
sudo chown "$USER:admin" /usr/local/sbin || true
fi
cd $DOTFILES_DIR || exit 1
echo 'Installing dependencies using brew...'
brew bundle
)
# Add the new shell to the list of allowed shells
if ! grep -q "/opt/homebrew/bin/zsh" /etc/shells; then
sudo zsh -c 'echo /opt/homebrew/bin/zsh >> /etc/shells'
fi
# change to the new shell
if [ "$SHELL" != "/opt/homebrew/bin/zsh" ]; then
chsh -s /opt/homebrew/bin/zsh
fi
# Link config files
(
cd $DOTFILES_DIR || exit 1
for APP in "${STOW_FILES_HOME[@]}"; do
stow "${APP}"
done
export XDG_CONFIG_HOME=~/.config
for APP in "${STOW_FILES_XDG[@]}"; do
stow -t "$XDG_CONFIG_HOME" "${APP}"
done
)
$DOTFILES_DIR/setup-macos
echo "------------------------------------------------------------------------------"
echo "Final instructions"
echo "------------------------------------------------------------------------------"
echo
echo "Before start using the computer, please restart the SO to reload all changes"
echo "made by this script!"
echo
echo "After configure the git client properly, please run the file:"
echo " $ ~/dotfiles/setup-after-git"