Last active
July 15, 2025 13:18
-
-
Save alextakitani/d23e22324537c24c102fb8d37af016cd to your computer and use it in GitHub Desktop.
Post install Fedora 42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# post_install_k.sh - Fedora 42 | |
# Script pós-instalação otimizado para Fedora 42 com UX aprimorada | |
set -e | |
# Cores para mensagens | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
YELLOW='\033[1;33m' | |
BLUE='\033[1;34m' | |
NC='\033[0m' # No Color | |
# Função para exibir barra de progresso fake | |
progress_bar() { | |
local duration=${1:-2} # Slightly faster default | |
local message="${2:-Processando...}" | |
echo -ne "${BLUE}$message${NC}\n" | |
local cols=$(tput cols 2>/dev/null || echo 80) | |
local bar_width=$((cols - 10)) | |
[[ $bar_width -lt 20 ]] && bar_width=20 # Minimum width | |
for ((i=0;i<=duration;i++)); do | |
local progress=$((i * 100 / duration)) | |
local filled_width=$((i * bar_width / duration)) | |
echo -ne "[" | |
printf '%*s' "$filled_width" '' | tr ' ' '#' | |
printf '%*s' "$((bar_width - filled_width))" '' | |
echo -ne "] ${progress}%\r" | |
sleep 0.5 | |
done | |
echo -e "\n" | |
} | |
# Função para mensagens destacadas | |
msg() { echo -e "${GREEN}==> $1${NC}"; } | |
warn() { echo -e "${YELLOW}WARN: $1${NC}"; } | |
err() { echo -e "${RED}ERRO: $1${NC}"; exit 1; } | |
# Checar se está executando como root | |
if [[ $EUID -eq 0 ]]; then | |
err "Este script não deve ser executado como root. Use seu usuário normal (sudo será solicitado quando necessário)." | |
fi | |
msg "Atualizando sistema..." | |
progress_bar 2 "Atualizando pacotes do sistema" | |
sudo dnf copr enable gierth/tiny-tools -y | |
sudo dnf update -y && sudo dnf upgrade -y | |
msg "Instalando pacotes essenciais, ferramentas e dependências..." | |
progress_bar 4 "Instalando utilitários, ferramentas de dev, fontes, plugins, etc." | |
sudo dnf install -y \ | |
zsh openssh-clients curl nfs-utils zenity gnome-keyring git cmake gcc-c++ make \ | |
vim curl-devel htop iotop ImageMagick ImageMagick-devel fira-code-fonts imwheel \ | |
tmux rust yaml-cpp-devel gawk translate-shell fzf ripgrep bat eza \ | |
ethtool stow unzip wget dnf-plugins-core flatpak atuin konsole \ | |
neovim lazygit vips-devel libyaml-devel zstd\ | |
|| err "Falha ao instalar pacotes essenciais via DNF." | |
msg "Instalando client Postgres 17" | |
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/F-42-x86_64/pgdg-fedora-repo-latest.noarch.rpm | |
sudo dnf install -y postgresql17 postgresql17-devel libpq5-devel | |
msg "Configurando Flatpak e Flathub..." | |
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo | |
msg "Configurando locale para pt_BR.UTF-8..." | |
sudo localectl set-locale LANG=pt_BR.UTF-8 | |
# Fix cedilha teclado en-us | |
msg "Ajustando cedilha para teclado internacional..." | |
cd /tmp | |
if wget -q https://raw.githubusercontent.com/marcopaganini/gnome-cedilla-fix/master/fix-cedilla -O fix-cedilla; then | |
chmod 755 fix-cedilla | |
# Execute silently, check exit code | |
if ! ./fix-cedilla > /dev/null 2>&1; then | |
warn "O script fix-cedilla retornou um erro (pode já ter sido aplicado ou falhou)." | |
fi | |
rm -f fix-cedilla | |
else | |
warn "Falha ao baixar o script fix-cedilla." | |
fi | |
cd - | |
# Docker | |
msg "Instalando Docker..." | |
progress_bar 2 "Adicionando repositório e instalando Docker" | |
sudo dnf-3 config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo | |
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin || err "Falha ao instalar Docker." | |
# LAZYDOCKER | |
msg "Instalando LazyDocker pelo repositório COPR..." | |
# dnf-plugins-core was installed earlier | |
sudo dnf copr enable -y atim/lazydocker || warn "Falha ao habilitar COPR atim/lazydocker." | |
sudo dnf install -y lazydocker || warn "Falha ao instalar lazydocker." | |
# Nerd Fonts | |
msg "Instalando fontes Nerd Fonts (CascadiaMono, FiraCode, FiraMono)..." | |
mkdir -p ~/.local/share/fonts | |
cd /tmp | |
for font in CascadiaMono FiraCode FiraMono; do | |
wget -q https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${font}.zip | |
unzip -o ${font}.zip -d ${font} | |
cp ${font}/*.{ttf,otf} ~/.local/share/fonts 2>/dev/null || true | |
rm -rf ${font}.zip ${font} | |
done | |
fc-cache -fv | |
cd - | |
# Antigen (ZSH plugin manager) | |
msg "Instalando Antigen para ZSH..." | |
[ -f "$HOME/antigen.zsh" ] || curl -L git.io/antigen > "$HOME/antigen.zsh" | |
# Mudar shell padrão para zsh | |
msg "Alterando shell padrão para zsh (será solicitada senha)..." | |
chsh -s $(which zsh) $USER | |
msg "Configuração concluída com sucesso! Faça logout/login para aplicar todas as alterações." | |
cat << EOF >> ~/.zshrc | |
source $HOME/antigen.zsh | |
# Load the oh-my-zsh's library | |
antigen use oh-my-zsh | |
antigen bundle git | |
# Syntax highlighting bundle. | |
antigen bundle zsh-users/zsh-syntax-highlighting | |
# Fish-like auto suggestions | |
antigen bundle zsh-users/zsh-autosuggestions | |
# Extra zsh completions | |
antigen bundle zsh-users/zsh-completions | |
antigen bundle command-not-found | |
antigen bundle bundler | |
antigen bundle z | |
# Load the theme | |
#antigen theme robbyrussell | |
antigen theme romkatv/powerlevel10k | |
# Tell antigen that you're done | |
antigen apply | |
alias dm='bundle exec rake db:migrate' | |
alias dmt='bundle exec rake db:migrate && rake db:test:prepare' | |
alias dmp='RAILS_ENV=production bundle exec rake db:migrate' | |
alias rc='bundle exec rails c' | |
alias rg='bundle exec rails g' | |
alias rcp='RAILS_ENV=production bundle exec rails c' | |
alias rs='bundle exec rails s' | |
alias rsp='RAILS_ENV=production bundle exec rails s' | |
alias pywww='python -m SimpleHTTPServer' | |
alias os='overmind s' | |
alias oc='overmind connect web' | |
alias ls='eza -lh --group-directories-first --icons' | |
alias lsa='ls -a' | |
alias lt='eza --tree --level=2 --long --icons --git' | |
alias lta='lt -a' | |
alias ff="fzf --preview 'batcat --style=numbers --color=always {}'" | |
EOF | |
# Mise | |
msg "Instalando Mise pelo repositório RPM..." | |
# dnf-plugins-core was installed earlier | |
sudo dnf config-manager addrepo --from-repofile=https://mise.jdx.dev/rpm/mise.repo | |
sudo dnf install -y mise || warn "Falha ao instalar mise." | |
if ! grep -q 'mise activate zsh' ~/.zshrc 2>/dev/null; then | |
echo 'eval "$(/usr/bin/mise activate zsh)"' >> ~/.zshrc | |
fi | |
# VSCode | |
msg "Instalando VSCode..." | |
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc | |
echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\nautorefresh=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null | |
sudo dnf check-update | |
sudo dnf install code -y | |
# Configuração do VSCode para abrir links code:// | |
msg "Configurando VSCode para abrir links code://..." | |
sudo bash -c 'cat << EOF > /usr/share/applications/vscode-urihandler.desktop | |
[Desktop Entry] | |
Name=VSCode | |
Comment=Open code:// links in Atom editor | |
GenericName=URI handler | |
Exec=/usr/bin/code-urihandler %U | |
Icon=code | |
Type=Application | |
StartupNotify=true | |
Categories=GNOME;GTK;Utility;TextEditor;Development; | |
MimeType=x-scheme-handler/code | |
EOF' | |
sudo bash -c 'cat << EOF > /usr/bin/code-urihandler | |
#!/bin/bash | |
request=\${1:23} | |
request=\${request//%2F//} | |
request=\${request/&line=/:} | |
code -g "\$request" | |
EOF' | |
sudo chmod +x /usr/bin/code-urihandler | |
sudo update-desktop-database | |
sudo bash -c 'cat << EOF > /etc/sysctl.conf | |
fs.inotify.max_user_watches=524288 | |
fs.inotify.max_user_instances = 256 | |
EOF' | |
echo 'gem: --no-document' > ~/.gemrc | |
chsh -s /bin/zsh | |
flatpak install flathub io.missioncenter.MissionCenter com.discordapp.Discord io.dbeaver.DBeaverCommunity org.gnome.meld org.gnome.Calculator com.github.tchx84.Flatseal com.bitwarden.desktop com.rtosta.zapzap com.dropbox.Client org.gimp.GIMP org.kde.kolourpaint net.cozic.joplin_desktop com.github.dynobo.normcap io.gitlab.liferooter.TextPieces io.github.thetumultuousunicornofdarkness.cpu-x com.github.hluk.copyq org.localsend.localsend_app -y | |
zsh -c 'source ~/.zshrc; mise use --global node@20' | |
zsh -c 'source ~/.zshrc; mise use [email protected]' | |
zsh -c 'source ~/.zshrc; RUBY_CONFIGURE_OPTS=--enable-yjit mise use --global [email protected]' | |
# Ghostty (terminal moderno) | |
msg "Instalando Ghostty pelo repositório COPR..." | |
# dnf-plugins-core was installed earlier | |
sudo dnf copr enable -y pgdev/ghostty | |
sudo dnf install -y ghostty || msg "Falha ao instalar Ghostty." | |
#Overmind | |
OVERMIND_LAST_VERSION=`curl -s https://api.github.com/repos/DarthSim/overmind/releases/latest | jq '.assets[] | select(.name|match("linux-amd64.gz$")) | .name' | tr -d '"'` | |
OVERMIND_LAST_VERSION_FILE=`echo $OVERMIND_LAST_VERSION | rev | cut -f 2- -d '.' | rev` | |
curl -s https://api.github.com/repos/DarthSim/overmind/releases/latest | jq '.assets[] | select(.name|match("linux-amd64.gz$")) | .browser_download_url' | xargs -n 1 wget | |
gunzip $OVERMIND_LAST_VERSION | |
sudo mv $OVERMIND_LAST_VERSION_FILE /usr/local/bin/overmind | |
chmod +x /usr/local/bin/overmind | |
# makes Krunner open with the Meta Key | |
# kwriteconfig6 --file ~/.config/kwinrc --group ModifierOnlyShortcuts --key Meta "org.kde.kglobalaccel,/component/org_kde_krunner_desktop,,invokeShortcut,_launch" && qdbus org.kde.KWin /KWin reconfigure | |
# Aplicativos extras para Fedora | |
msg "Instalando aplicativos extras (balena-etcher, brave-browser, insync, fastfetch, microsoft-edge)..." | |
# balena-etcher | |
msg "Instalando balena-etcher..." | |
wget -qO /tmp/balena-etcher.rpm "https://github.com/balena-io/etcher/releases/latest/download/balena-etcher-electron-x64.rpm" | |
sudo dnf install -y /tmp/balena-etcher.rpm || msg "Falha ao instalar balena-etcher." | |
rm -f /tmp/balena-etcher.rpm | |
# brave-browser | |
msg "Instalando brave-browser..." | |
# dnf-plugins-core was installed earlier | |
sudo dnf config-manager addrepo --from-repofile=https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo | |
sudo dnf install -y brave-browser || msg "Falha ao instalar brave-browser." | |
# insync | |
# fastfetch | |
msg "Instalando fastfetch..." | |
sudo dnf install -y fastfetch || msg "Falha ao instalar fastfetch." | |
# microsoft-edge-stable | |
msg "Instalando Microsoft Edge..." | |
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc | |
echo -e "[microsoft-edge]\nname=microsoft-edge\nbaseurl=https://packages.microsoft.com/yumrepos/edge/\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc"|sudo tee /etc/yum.repos.d/microsoft-edge.repo | |
yes | sudo dnf install microsoft-edge-stable || msg "Falha ao instalar Microsoft Edge." | |
# ATUIN | |
curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh | |
sed -i 's|eval "$(atuin init zsh)"|eval "$(atuin init zsh --disable-up-arrow)"|' ~/.zshrc | |
# Konsole | |
cat << EOF >> "$HOME/.local/share/konsole/Profile 1.profile" | |
[Appearance] | |
ColorScheme=Solarized | |
Font=FiraMono Nerd Font Mono,10,-1,5,50,0,0,0,0,0 | |
[General] | |
Command=/bin/zsh -l | |
Environment=TERM=xterm-256color,COLORTERM=truecolor,SHELL=/bin/zsh | |
Name=Profile 1 | |
Parent=FALLBACK/ | |
[Interaction Options] | |
AutoCopySelectedText=true | |
TextEditorCmd=6 | |
TextEditorCmdCustom=code -g PATH:LINE | |
TrimLeadingSpacesInSelectedText=true | |
TrimTrailingSpacesInSelectedText=true | |
UnderlineFilesEnabled=true | |
EOF | |
sed -i '1i\[Desktop Entry]\nDefaultProfile=Profile 1.profile\n' ~/.config/konsolerc | |
#WOL | |
# Descobre a interface principal | |
interface=$(ip route | awk '/default/ {print $5}') | |
# Verifica se a interface foi encontrada | |
if [ -z "$interface" ]; then | |
msg "Erro: Não foi possível encontrar a interface principal." | |
exit 1 | |
fi | |
# Descobre o caminho completo do comando ethtool | |
ethtool_path=$(command -v ethtool) | |
# Verifica se o ethtool está instalado | |
if [ -z "$ethtool_path" ]; then | |
msg "Erro: ethtool não está instalado. Instale-o com: sudo dnf install ethtool" | |
exit 1 | |
fi | |
# Conteúdo do serviço | |
service_content="[Unit] | |
Description=Enable Wake On Lan | |
[Service] | |
Type=oneshot | |
ExecStart=$ethtool_path --change $interface wol g | |
[Install] | |
WantedBy=basic.target | |
" | |
# Caminho para o arquivo do serviço | |
service_file="/etc/systemd/system/wol.service" | |
# Cria o arquivo do serviço | |
msg "Criando o arquivo $service_file..." | |
echo "$service_content" | sudo tee $service_file > /dev/null | |
# Define as permissões corretas | |
sudo chmod 644 $service_file | |
# Recarrega o systemd e habilita o serviço | |
msg "Recarregando o systemd e habilitando o serviço..." | |
sudo systemctl daemon-reload | |
sudo systemctl enable wol.service | |
msg "LazyVim" | |
git clone https://github.com/LazyVim/starter ~/.config/nvim | |
rm -rf ~/.config/nvim/.git | |
msg "Instalando Windsurf Editor..." | |
sudo rpm --import https://windsurf-stable.codeiumdata.com/wVxQEIWkwPUEAGf3/yum/RPM-GPG-KEY-windsurf | |
echo -e "[windsurf] | |
name=Windsurf Repository | |
baseurl=https://windsurf-stable.codeiumdata.com/wVxQEIWkwPUEAGf3/yum/repo/ | |
enabled=1 | |
autorefresh=1 | |
gpgcheck=1 | |
gpgkey=https://windsurf-stable.codeiumdata.com/wVxQEIWkwPUEAGf3/yum/RPM-GPG-KEY-windsurf" | sudo tee /etc/yum.repos.d/windsurf.repo > /dev/null | |
sudo dnf check-update | |
sudo dnf install -y windsurf | |
sudo dnf autoremove -y | |
msg "Acabou! Faça um boot ou logout. Crie um profile no Konsole para usar o zsh no Fedora!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment