-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
82 lines (66 loc) · 2.12 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
#!/bin/bash
set -e # stop the script if it gives an error
echo ""
echo "-> Iniciando configuração do ambiente..."
# directory of the script
DOTFILES_DIR="$HOME/.dotfiles"
SETUP_DIR="$HOME/.wsl-ubuntu-setup"
# function to clone dotfiles
clone_dotfiles() {
if [ -d "$DOTFILES_DIR" ]; then
read -p "O diretório .dotfiles já existe. Deseja sobrescrevê-lo? (y/n) " confirm
if [[ "$confirm" != "y" ]]; then
echo "Operação cancelada. O diretório .dotfiles não foi sobrescrito."
return
fi
rm -rf "$DOTFILES_DIR"
fi
git clone https://github.com/marcelohfonseca/dotfiles.git "$DOTFILES_DIR"
}
# function to execute scripts
install_scripts() {
local category="$1"
for script in "$SETUP_DIR/install/$category/"*.sh; do
echo ""
echo "-> Executando script: $script"
bash "$script"
done
}
# install system prerequisites
echo ""
echo "-> Instalando pré-requisitos..."
bash "$SETUP_DIR/install/prerequisites.sh" || { echo "Falha ao executar prerequisites.sh. Abortando."; }
# delete content from .oh-my-zsh
rm -rf "$HOME/.oh-my-zsh"
# install scripts
install_scripts "utilities"
install_scripts "tools"
#source $HOME/.cargo/env
install_scripts "python-libraries"
export PATH="/home/marcelo/.local/bin:$PATH"
# delete dotfiles
echo ""
echo "-> Deletando dotfiles..."
rm -rf "$HOME/.aliases"
rm -rf "$HOME/.gitconfig"
rm -rf "$HOME/.zshrc"
rm -rf "$HOME/.zprofile"
rm -rf "$HOME/.p10k.zsh"
# clone dotfiles
clone_dotfiles
# create symlinks for dotfiles
echo ""
echo "-> Criando links simbólicos para os dotfiles..."
ln -s "$HOME/.dotfiles/aliases/.aliases" "$HOME/.aliases"
ln -s "$HOME/.dotfiles/git/.gitconfig" "$HOME/.gitconfig"
ln -s "$HOME/.dotfiles/zsh/.zshrc" "$HOME/.zshrc"
ln -s "$HOME/.dotfiles/zsh/.zprofile" "$HOME/.zprofile"
ln -s "$HOME/.dotfiles/zsh/.p10k.zsh" "$HOME/.p10k.zsh"
# reload new settings
echo ""
echo "-> Alterando terminal padrão..."
chsh -s $(which zsh) $USER
#source ~/.zshrc || { echo "Falha ao tentar aplicar as mudanças em ~/.zshrc. Reinicie seu terminal."; }
echo ""
echo "-> Configuração do ambiente finalizada!"
exit