Last active
September 11, 2025 14:46
-
-
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 | |
| 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 "RPM Fusion" | |
| if ! dnf repolist | grep -q "rpmfusion-free"; then | |
| sudo dnf install -y "https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" | |
| fi | |
| if ! dnf repolist | grep -q "rpmfusion-nonfree"; then | |
| sudo dnf install -y "https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm" | |
| fi | |
| msg "Atualizando sistema..." | |
| progress_bar 2 "Atualizando pacotes do sistema" | |
| if ! dnf copr list | grep -q "gierth/tiny-tools"; then | |
| echo "y" | sudo dnf copr enable gierth/tiny-tools | |
| fi | |
| if ! dnf copr list | grep -q "aflyhorse/libjpeg"; then | |
| echo "y" | sudo dnf copr enable aflyhorse/libjpeg | |
| fi | |
| 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 \ | |
| neovim lazygit vips-devel libyaml-devel zstd libjpeg8\ | |
| || 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 | |
| msg "Google Chrome" | |
| if ! rpm -q fedora-workstation-repositories >/dev/null 2>&1; then | |
| sudo dnf install -y fedora-workstation-repositories | |
| fi | |
| if ! dnf repolist | grep -q "google-chrome"; then | |
| sudo dnf config-manager setopt google-chrome.enabled=1 | |
| fi | |
| if ! rpm -q google-chrome-stable >/dev/null 2>&1; then | |
| sudo dnf install -y google-chrome-stable | |
| fi | |
| msg "Codecs" | |
| if rpm -q ffmpeg-free >/dev/null 2>&1; then | |
| sudo dnf swap -y ffmpeg-free ffmpeg --allowerasing | |
| fi | |
| if ! rpm -qa | grep -q "gstreamer1-plugins"; then | |
| sudo dnf update -y @multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin | |
| fi | |
| if ! rpm -q x264 >/dev/null 2>&1; then | |
| sudo dnf install -y amrnb amrwb faad2 flac gpac-libs lame libde265 libfc14audiodecoder mencoder x264 x265 | |
| fi | |
| msg "Aceleracao AMD" | |
| if rpm -q mesa-va-drivers >/dev/null 2>&1; then | |
| sudo dnf swap -y mesa-va-drivers mesa-va-drivers-freeworld | |
| fi | |
| if rpm -q mesa-vdpau-drivers >/dev/null 2>&1; then | |
| sudo dnf swap -y mesa-vdpau-drivers mesa-vdpau-drivers-freeworld | |
| fi | |
| if rpm -q mesa-va-drivers.i686 >/dev/null 2>&1; then | |
| sudo dnf swap -y mesa-va-drivers.i686 mesa-va-drivers-freeworld.i686 | |
| fi | |
| if rpm -q mesa-vdpau-drivers.i686 >/dev/null 2>&1; then | |
| sudo dnf swap -y mesa-vdpau-drivers.i686 mesa-vdpau-drivers-freeworld.i686 | |
| fi | |
| msg "VLC" | |
| sudo dnf install -y vlc | |
| # 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" | |
| if ! dnf repolist | grep -q "docker-ce"; then | |
| sudo dnf config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo | |
| fi | |
| if ! rpm -q docker-ce >/dev/null 2>&1; then | |
| sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin || err "Falha ao instalar Docker." | |
| fi | |
| # LAZYDOCKER | |
| msg "Instalando LazyDocker pelo repositório COPR..." | |
| # dnf-plugins-core was installed earlier | |
| if ! dnf copr list | grep -q "atim/lazydocker"; then | |
| echo "y" | sudo dnf copr enable atim/lazydocker || warn "Falha ao habilitar COPR atim/lazydocker." | |
| fi | |
| if ! rpm -q lazydocker >/dev/null 2>&1; then | |
| sudo dnf install -y lazydocker || warn "Falha ao instalar lazydocker." | |
| fi | |
| # Nerd Fonts | |
| msg "Instalando fontes Nerd Fonts (CascadiaMono, FiraCode, FiraMono)..." | |
| mkdir -p ~/.local/share/fonts | |
| # Verificar se as fontes já estão instaladas | |
| fonts_missing=false | |
| for font in "CascadiaMono" "FiraCode" "FiraMono"; do | |
| if ! fc-list | grep -qi "$font.*Nerd"; then | |
| fonts_missing=true | |
| break | |
| fi | |
| done | |
| if [ "$fonts_missing" = true ]; then | |
| cd /tmp | |
| for font in CascadiaMono FiraCode FiraMono; do | |
| if ! fc-list | grep -qi "$font.*Nerd"; then | |
| msg "Baixando fonte $font..." | |
| if wget -q --connect-timeout=30 --read-timeout=60 https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${font}.zip; then | |
| if unzip -o ${font}.zip -d ${font} >/dev/null 2>&1; then | |
| cp ${font}/*.{ttf,otf} ~/.local/share/fonts 2>/dev/null || true | |
| else | |
| warn "Falha ao extrair fonte $font" | |
| fi | |
| rm -rf ${font}.zip ${font} | |
| else | |
| warn "Falha ao baixar fonte $font" | |
| fi | |
| fi | |
| done | |
| fc-cache -fv >/dev/null 2>&1 | |
| cd - | |
| else | |
| msg "Fontes Nerd já instaladas" | |
| fi | |
| # Antigen (ZSH plugin manager) | |
| msg "Instalando Antigen para ZSH..." | |
| if [ ! -f "$HOME/antigen.zsh" ]; then | |
| # Tentar curl primeiro | |
| if curl -L --connect-timeout 30 --max-time 60 https://raw.githubusercontent.com/zsh-users/antigen/master/bin/antigen.zsh > "$HOME/antigen.zsh" 2>/dev/null; then | |
| msg "Antigen baixado com sucesso" | |
| else | |
| # Fallback: git clone | |
| cd /tmp | |
| if git clone --depth=1 https://github.com/zsh-users/antigen.git antigen-repo 2>/dev/null; then | |
| cp antigen-repo/bin/antigen.zsh "$HOME/antigen.zsh" | |
| rm -rf antigen-repo | |
| msg "Antigen instalado via git clone" | |
| else | |
| warn "Falha ao baixar Antigen - ZSH funcionará sem plugins" | |
| fi | |
| cd - | |
| fi | |
| fi | |
| # Mudar shell padrão para zsh | |
| if [ "$SHELL" != "$(command -v zsh)" ]; then | |
| msg "Alterando shell padrão para zsh (será solicitada senha)..." | |
| chsh -s "$(command -v zsh)" "$USER" | |
| fi | |
| msg "Configuração concluída com sucesso! Faça logout/login para aplicar todas as alterações." | |
| if [ ! -f "$HOME/.zshrc" ] || ! grep -q "antigen use oh-my-zsh" ~/.zshrc; then | |
| 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 | |
| fi | |
| # Mise | |
| msg "Instalando Mise pelo repositório RPM..." | |
| # dnf-plugins-core was installed earlier | |
| if ! dnf repolist | grep -q "mise"; then | |
| sudo dnf config-manager addrepo --from-repofile=https://mise.jdx.dev/rpm/mise.repo | |
| fi | |
| if ! rpm -q mise >/dev/null 2>&1; then | |
| sudo dnf install -y mise || warn "Falha ao instalar mise." | |
| fi | |
| if ! grep -q 'mise activate zsh' ~/.zshrc 2>/dev/null; then | |
| # shellcheck disable=SC2016 | |
| printf '%s\n' 'eval "$([ -x /usr/bin/mise ] && /usr/bin/mise activate zsh)"' >> ~/.zshrc | |
| fi | |
| # VSCode | |
| msg "Instalando VSCode..." | |
| if ! rpm -q gpg-pubkey --qf '%{summary}\n' | grep -q "Microsoft"; then | |
| sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc | |
| fi | |
| if [ ! -f "/etc/yum.repos.d/vscode.repo" ]; then | |
| 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 | |
| fi | |
| if ! rpm -q code >/dev/null 2>&1; then | |
| sudo dnf check-update | |
| sudo dnf install -y code | |
| fi | |
| # Configurar Docker para o usuário e criar containers | |
| msg "Configurando Docker para o usuário atual..." | |
| sudo usermod -aG docker "${USER}" | |
| # Habilitar Docker para iniciar no boot | |
| sudo systemctl enable docker | |
| sudo systemctl start docker | |
| # Limitar tamanho do log para evitar ficar sem espaço | |
| echo '{"log-driver":"json-file","log-opts":{"max-size":"10m","max-file":"5"}}' | sudo tee /etc/docker/daemon.json > /dev/null | |
| msg "Criando containers Redis e PostgreSQL..." | |
| # Verificar se os containers já existem antes de criar | |
| if ! sudo docker ps -a | grep -q "redis"; then | |
| sudo docker create --restart unless-stopped -p "127.0.0.1:6379:6379" --name=redis redis:7 | |
| fi | |
| if ! sudo docker ps -a | grep -q "postgres17"; then | |
| sudo docker create --restart unless-stopped -p "127.0.0.1:5432:5432" --name=postgres17 -e POSTGRES_HOST_AUTH_METHOD=trust -e LANG=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 postgres:17 | |
| fi | |
| # Configuração do VSCode para abrir links code:// | |
| msg "Configurando VSCode para abrir links code://..." | |
| if [ ! -f "/usr/share/applications/vscode-urihandler.desktop" ]; then | |
| 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' | |
| fi | |
| if [ ! -f "/usr/bin/code-urihandler" ]; then | |
| 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 | |
| fi | |
| if ! grep -q "fs.inotify.max_user_watches" /etc/sysctl.conf; then | |
| sudo bash -c 'cat << EOF >> /etc/sysctl.conf | |
| fs.inotify.max_user_watches=524288 | |
| fs.inotify.max_user_instances = 256 | |
| EOF' | |
| fi | |
| if [ ! -f "$HOME/.gemrc" ] || ! grep -q "no-document" ~/.gemrc; then | |
| echo 'gem: --no-document' > ~/.gemrc | |
| fi | |
| # Shell já foi configurado anteriormente | |
| # Verificar se os flatpaks principais já estão instalados | |
| if ! flatpak list | grep -q "io.missioncenter.MissionCenter"; then | |
| flatpak install -y --noninteractive 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 org.localsend.localsend_app | |
| else | |
| msg "Flatpaks já instalados" | |
| fi | |
| if ! mise ls | grep -q "node.*20"; then | |
| zsh -c 'source ~/.zshrc; mise use --global node@20' | |
| fi | |
| if ! mise ls | grep -q "ruby.*3.4.4"; then | |
| zsh -c 'source ~/.zshrc; RUBY_CONFIGURE_OPTS=--enable-yjit mise use --global ruby@3.4.4' | |
| fi | |
| # Ghostty (terminal moderno) | |
| msg "Instalando Ghostty pelo repositório COPR..." | |
| # dnf-plugins-core was installed earlier | |
| if ! dnf copr list | grep -q "pgdev/ghostty"; then | |
| echo "y" | sudo dnf copr enable pgdev/ghostty | |
| fi | |
| if ! rpm -q ghostty >/dev/null 2>&1; then | |
| sudo dnf install -y ghostty || msg "Falha ao instalar Ghostty." | |
| fi | |
| #Overmind | |
| if [ ! -f "/usr/local/bin/overmind" ]; then | |
| 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 | |
| sudo chmod +x /usr/local/bin/overmind | |
| fi | |
| # Ajusta o atalho do lançador de aplicativos no Plasma (remove Meta\t, deixa só Alt+F1) | |
| KSC_FILE="$HOME/.config/kglobalshortcutsrc" | |
| if [ -f "$KSC_FILE" ]; then | |
| sed -i '/^activate application launcher=/s/Meta\\t//g' "$KSC_FILE" | |
| fi | |
| # Garante atalho do KRunner no kglobalshortcutsrc (Meta key) | |
| if [ -f "$KSC_FILE" ] && ! grep -q '^\[services\]\[org.kde.krunner.desktop\]' "$KSC_FILE"; then | |
| { | |
| echo "" | |
| echo "[services][org.kde.krunner.desktop]" | |
| printf '%s\n' "_launch=Search\tMeta\tAlt+F2\tAlt+Space" | |
| } >> "$KSC_FILE" | |
| fi | |
| # Configura atalho global para Ghostty (Meta+Return) | |
| msg "Configurando atalho global Meta+Return para Ghostty..." | |
| if [ -f "$KSC_FILE" ]; then | |
| # Remove configuração existente se houver | |
| sed -i '/^\[services\]\[com.mitchellh.ghostty.desktop\]/,/^$/d' "$KSC_FILE" | |
| # Adiciona nova configuração | |
| { | |
| echo "" | |
| echo "[services][com.mitchellh.ghostty.desktop]" | |
| echo "_launch=Meta+Return" | |
| } >> "$KSC_FILE" | |
| msg "Atalho Meta+Return configurado para Ghostty" | |
| else | |
| warn "Arquivo kglobalshortcutsrc não encontrado" | |
| fi | |
| # Configura KRunner para aparecer no centro da tela (FreeFloating) | |
| mkdir -p ~/.config | |
| cat << EOF > ~/.config/krunnerrc | |
| [General] | |
| FreeFloating=true | |
| EOF | |
| # Configura KDE para tema escuro | |
| msg "Configurando tema escuro do KDE..." | |
| mkdir -p ~/.config | |
| # Define o Look and Feel package como Breeze Dark | |
| kwriteconfig6 --file ~/.config/kdeglobals --group KDE --key LookAndFeelPackage "org.kde.breezedark.desktop" | |
| # Define o esquema de cores (sem espaço no nome) | |
| kwriteconfig6 --file ~/.config/kdeglobals --group General --key ColorScheme "BreezeDark" | |
| # Aplica o tema completo usando lookandfeeltool | |
| lookandfeeltool -a org.kde.breezedark.desktop | |
| # Configura relógio para formato 24h e data dd/MM/yy | |
| msg "Configurando relógio para 24h e formato de data dd/MM/yy..." | |
| PLASMA_CONFIG="$HOME/.config/plasma-org.kde.plasma.desktop-appletsrc" | |
| if [ -f "$PLASMA_CONFIG" ]; then | |
| # Encontra o ID do applet digitalclock | |
| CLOCK_APPLET_ID=$(grep -B2 "plugin=org.kde.plasma.digitalclock" "$PLASMA_CONFIG" | grep "^\[.*Applets\]" | grep -o '\[Applets\]\[[0-9]*\]' | grep -o '[0-9]*' | head -1) | |
| if [ -n "$CLOCK_APPLET_ID" ]; then | |
| # Configura formato 24h (2 = forçar 24h) | |
| kwriteconfig6 --file "$PLASMA_CONFIG" --group "Containments][2][Applets][$CLOCK_APPLET_ID][Configuration][Appearance" --key "use24hFormat" "2" | |
| # Configura formato de data customizado | |
| kwriteconfig6 --file "$PLASMA_CONFIG" --group "Containments][2][Applets][$CLOCK_APPLET_ID][Configuration][Appearance" --key "dateFormat" "custom" | |
| # Define formato dd/MM/yy | |
| kwriteconfig6 --file "$PLASMA_CONFIG" --group "Containments][2][Applets][$CLOCK_APPLET_ID][Configuration][Appearance" --key "customDateFormat" "dd/MM/yy" | |
| msg "Relógio configurado com sucesso para 24h e formato dd/MM/yy" | |
| else | |
| warn "Não foi possível encontrar o applet do relógio digital" | |
| fi | |
| else | |
| warn "Arquivo de configuração do Plasma não encontrado" | |
| fi | |
| # Aplicativos extras para Fedora | |
| msg "Instalando aplicativos extras (balena-etcher, brave-browser, insync, fastfetch, microsoft-edge)..." | |
| # balena-etcher | |
| msg "Instalando balena-etcher..." | |
| if ! rpm -q balena-etcher >/dev/null 2>&1; then | |
| wget -qO /tmp/balena-etcher.rpm "https://github.com/balena-io/etcher/releases/download/v2.1.4/balena-etcher-2.1.4-1.x86_64.rpm" | |
| sudo dnf install -y /tmp/balena-etcher.rpm || warn "Falha ao instalar balena-etcher." | |
| rm -f /tmp/balena-etcher.rpm | |
| fi | |
| # brave-browser | |
| msg "Instalando brave-browser..." | |
| # dnf-plugins-core was installed earlier | |
| if ! dnf repolist | grep -q "brave-browser"; then | |
| sudo dnf config-manager addrepo --from-repofile=https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo | |
| fi | |
| if ! rpm -q brave-browser >/dev/null 2>&1; then | |
| sudo dnf install -y brave-browser || warn "Falha ao instalar brave-browser." | |
| fi | |
| # insync | |
| msg "Instalando Insync..." | |
| if ! rpm -q gpg-pubkey --qf '%{summary}\n' | grep -q "insync"; then | |
| curl -s https://d2t3ff60b2tol4.cloudfront.net/repomd.xml.key > /tmp/insync.key && sudo rpm --import /tmp/insync.key | |
| fi | |
| if [ ! -f "/etc/yum.repos.d/insync.repo" ]; then | |
| echo -e "[insync]\nname=insync\nbaseurl=http://yum.insync.io/fedora/\$releasever/\nenabled=1\ngpgcheck=1\ngpgkey=https://d2t3ff60b2tol4.cloudfront.net/repomd.xml.key" | sudo tee /etc/yum.repos.d/insync.repo | |
| fi | |
| if ! rpm -q insync >/dev/null 2>&1; then | |
| sudo dnf install -y insync || warn "Falha ao instalar Insync." | |
| fi | |
| # fastfetch | |
| msg "Instalando fastfetch..." | |
| sudo dnf install -y fastfetch || warn "Falha ao instalar fastfetch." | |
| # microsoft-edge-stable | |
| msg "Instalando Microsoft Edge..." | |
| if ! rpm -q gpg-pubkey --qf '%{summary}\n' | grep -q "Microsoft"; then | |
| sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc | |
| fi | |
| if [ ! -f "/etc/yum.repos.d/microsoft-edge.repo" ]; then | |
| 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 | |
| fi | |
| if ! rpm -q microsoft-edge-stable >/dev/null 2>&1; then | |
| sudo dnf install -y microsoft-edge-stable || warn "Falha ao instalar Microsoft Edge." | |
| fi | |
| # ATUIN | |
| if ! command -v atuin >/dev/null 2>&1; then | |
| curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh | |
| fi | |
| if [ -f "$HOME/.zshrc" ] && grep -q "atuin init zsh" ~/.zshrc && ! grep -q "disable-up-arrow" ~/.zshrc; then | |
| # shellcheck disable=SC2016 | |
| sed -i 's|eval "$(atuin init zsh)"|eval "$(atuin init zsh --disable-up-arrow)"|' ~/.zshrc | |
| fi | |
| # Konsole | |
| # Konsole profile configuration | |
| if [ ! -f "$HOME/.local/share/konsole/Profile 1.profile" ]; then | |
| mkdir -p "$HOME/.local/share/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 | |
| fi | |
| if [ -f ~/.config/konsolerc ] && ! grep -q "DefaultProfile" ~/.config/konsolerc; then | |
| sed -i '1i\[Desktop Entry]\nDefaultProfile=Profile 1.profile\n' ~/.config/konsolerc | |
| fi | |
| #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" | |
| if [ ! -d "$HOME/.config/nvim" ]; then | |
| git clone https://github.com/LazyVim/starter ~/.config/nvim | |
| rm -rf ~/.config/nvim/.git | |
| fi | |
| # Configuração NFS para backup automático | |
| msg "Configurando montagem NFS para backup..." | |
| # Habilitar serviços NFS necessários | |
| if ! systemctl is-enabled nfs-utils >/dev/null 2>&1; then | |
| sudo systemctl enable --now nfs-utils rpcbind | |
| fi | |
| # Criar diretório de montagem se não existir | |
| if [ ! -d "/media/alex/backup" ]; then | |
| sudo mkdir -p /media/alex/backup | |
| sudo chown alex:alex /media/alex/backup | |
| fi | |
| # Adicionar entrada NFS ao fstab se não existir | |
| if ! grep -q "192.168.0.116:/volume1/Arquivos" /etc/fstab; then | |
| echo "192.168.0.116:/volume1/Arquivos /media/alex/backup nfs4 rw,noauto,x-systemd.automount,_netdev,user 0 0" | sudo tee -a /etc/fstab > /dev/null | |
| msg "Entrada NFS4 com automount adicionada ao fstab" | |
| # Recarregar systemd para reconhecer as novas montagens automáticas | |
| sudo systemctl daemon-reload | |
| # Iniciar o automount | |
| sudo systemctl start media-alex-backup.automount | |
| else | |
| msg "Entrada NFS já existe no fstab" | |
| fi | |
| msg "Montagem NFS configurada com sucesso em /media/alex/backup" | |
| sudo dnf autoremove -y | |
| msg "Acabou! Faça um boot ou logout. Lembre de trocar o shortcut do Spectacle para retangular region como print" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment