Last active
September 8, 2025 15:58
-
-
Save alextakitani/ada14ff88470107efe2ac5e4d01e89ff to your computer and use it in GitHub Desktop.
Post install Omarchy 2.1
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_omarchy.sh - Omarchy Linux | |
| # Script pós-instalação otimizado para Omarchy 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 | |
| # Instalar yay se não estiver presente | |
| if ! command -v yay &> /dev/null; then | |
| msg "Instalando yay (AUR helper)..." | |
| sudo pacman -S --needed --noconfirm base-devel git | |
| cd /tmp | |
| git clone https://aur.archlinux.org/yay.git | |
| cd yay | |
| makepkg -si --noconfirm | |
| cd - | |
| fi | |
| msg "Atualizando sistema..." | |
| progress_bar 2 "Atualizando pacotes do sistema" | |
| yay -Syu --noconfirm | |
| msg "Instalando pacotes essenciais, ferramentas e dependências..." | |
| progress_bar 4 "Instalando utilitários, ferramentas de dev, fontes, plugins, etc." | |
| yay -S --noconfirm \ | |
| zsh openssh curl nfs-utils zenity gnome-keyring git cmake gcc make \ | |
| vim htop iotop imagemagick \ | |
| tmux rust yaml-cpp gawk fzf ripgrep bat eza \ | |
| ethtool stow unzip wget vips libyaml zstd jq \ | |
| || err "Falha ao instalar pacotes essenciais." | |
| msg "Instalando PostgreSQL..." | |
| yay -S --noconfirm postgresql | |
| msg "Configurando locale para pt_BR.UTF-8..." | |
| sudo localectl set-locale LANG=pt_BR.UTF-8 | |
| # Fix cedilha para Wayland/Hyprland | |
| msg "Configurando cedilha para teclado internacional no Wayland..." | |
| # Adicionar variáveis de ambiente para cedilha | |
| if ! grep -q "GTK_IM_MODULE=cedilla" ~/.zshrc; then | |
| echo 'export GTK_IM_MODULE=cedilla' >> ~/.zshrc | |
| echo 'export QT_IM_MODULE=cedilla' >> ~/.zshrc | |
| fi | |
| # Configurar layout de teclado PT-BR no Hyprland | |
| msg "Configurando layout de teclado português brasileiro..." | |
| if [ -f ~/.config/hypr/input.conf ]; then | |
| # Fazer backup do arquivo original | |
| cp ~/.config/hypr/input.conf ~/.config/hypr/input.conf.bak | |
| # Adicionar layout brasileiro e US Internacional se não existir | |
| if ! grep -q "kb_layout = us,br" ~/.config/hypr/input.conf; then | |
| sed -i 's/# kb_layout = us,dk,eu/kb_layout = us,br/' ~/.config/hypr/input.conf | |
| sed -i 's/kb_options = compose:caps # ,grp:alts_toggle/kb_options = compose:caps,grp:alts_toggle/' ~/.config/hypr/input.conf | |
| # Adicionar variante internacional para cedilha e acentos no layout US | |
| sed -i '/kb_layout = us,br/a\ kb_variant = intl,' ~/.config/hypr/input.conf | |
| msg "Layout PT-BR e US Internacional adicionados ao Hyprland (Alt+Alt para alternar)" | |
| fi | |
| # Adicionar numlock ativado por padrão se não existir | |
| if ! grep -q "numlock_by_default = true" ~/.config/hypr/input.conf; then | |
| # Inserir numlock antes da seção touchpad | |
| sed -i '/touchpad {/i\ # Start with numlock on by default\n numlock_by_default = true\n' ~/.config/hypr/input.conf | |
| msg "Numlock ativado por padrão adicionado ao Hyprland" | |
| fi | |
| fi | |
| # Configurar indicador de layout no Waybar | |
| msg "Configurando indicador de layout de teclado na Waybar..." | |
| if [ -f ~/.config/waybar/config.jsonc ]; then | |
| # Fazer backup do arquivo waybar | |
| cp ~/.config/waybar/config.jsonc ~/.config/waybar/config.jsonc.bak | |
| # Adicionar módulo de idioma se não existir | |
| if ! grep -q "hyprland/language" ~/.config/waybar/config.jsonc; then | |
| # Adicionar módulo na seção modules-right | |
| sed -i '/"modules-right": \[/,/\]/ { | |
| /"group\/tray-expander",/ a\ | |
| "hyprland/language", | |
| }' ~/.config/waybar/config.jsonc | |
| # Adicionar configuração do módulo antes do último } | |
| sed -i '$i\ | |
| },\ | |
| "hyprland/language": {\ | |
| "format": "{}",\ | |
| "format-en": "INT",\ | |
| "format-br": "BR",\ | |
| "on-click": "hyprctl switchxkblayout at-translated-set-2-keyboard next"\ | |
| }' ~/.config/waybar/config.jsonc | |
| msg "Indicador de layout adicionado à Waybar" | |
| fi | |
| # Adicionar CSS para o módulo de idioma | |
| if [ -f ~/.config/waybar/style.css ] && ! grep -q "#language" ~/.config/waybar/style.css; then | |
| cp ~/.config/waybar/style.css ~/.config/waybar/style.css.bak | |
| sed -i '/#pulseaudio,/a\ | |
| #language,' ~/.config/waybar/style.css | |
| msg "CSS do indicador de layout adicionado" | |
| fi | |
| # Configurar monitores de CPU e memória na waybar | |
| if [ -f ~/.config/waybar/config.jsonc ]; then | |
| # Adicionar memory ao modules-right se ainda não existir | |
| if ! grep -q '"memory"' ~/.config/waybar/config.jsonc; then | |
| sed -i '/"cpu",/ a\ "memory",' ~/.config/waybar/config.jsonc | |
| msg "Módulo de memória adicionado à Waybar" | |
| fi | |
| # Atualizar configuração do CPU para mostrar porcentagem | |
| if ! grep -q '"format": " {usage}%"' ~/.config/waybar/config.jsonc; then | |
| sed -i 's/"format": ""/"format": " {usage}%"/' ~/.config/waybar/config.jsonc | |
| msg "Configuração do CPU atualizada com porcentagem" | |
| fi | |
| # Adicionar configuração do módulo memory se não existir | |
| if ! grep -q '"memory":' ~/.config/waybar/config.jsonc; then | |
| # Inserir configuração do memory após o módulo cpu | |
| sed -i '/},$/N;/},\n "clock":/i\ | |
| "memory": {\ | |
| "interval": 5,\ | |
| "format": " {percentage}%",\ | |
| "on-click": "alacritty -e btop"\ | |
| },' ~/.config/waybar/config.jsonc | |
| msg "Configuração do módulo de memória adicionada à Waybar" | |
| fi | |
| fi | |
| fi | |
| # Configurar Ghostty e personalizar bindings | |
| msg "Configurando Ghostty e personalizando keybindings..." | |
| if [ -f ~/.config/hypr/bindings.conf ]; then | |
| # Fazer backup do arquivo de bindings | |
| cp ~/.config/hypr/bindings.conf ~/.config/hypr/bindings.conf.bak | |
| # Certificar que o Ghostty está configurado como terminal | |
| if ! grep -q "\$terminal = ghostty" ~/.config/hypr/bindings.conf; then | |
| sed -i 's/\$terminal = .*/\$terminal = ghostty --gtk-single-instance=true/' ~/.config/hypr/bindings.conf | |
| msg "Ghostty configurado como terminal padrão" | |
| fi | |
| # Garantir binding SUPER+Enter para terminal | |
| if ! grep -q "bind = SUPER, Return, exec, ghostty" ~/.config/hypr/bindings.conf; then | |
| sed -i '/\$terminal = ghostty/a\ | |
| \ | |
| bind = SUPER, Return, exec, ghostty' ~/.config/hypr/bindings.conf | |
| msg "Keybinding SUPER+Enter adicionado para Ghostty" | |
| fi | |
| # Personalizar aplicações | |
| msg "Personalizando aplicações nos keybindings..." | |
| # Trocar Spotify por Google Music | |
| sed -i 's|bindd = SUPER, M, Music, exec, uwsm app -- spotify|bindd = SUPER, M, Music, exec, omarchy-launch-webapp "https://music.google.com"|' ~/.config/hypr/bindings.conf | |
| # Trocar Hey Calendar por Google Calendar | |
| sed -i 's|bindd = SUPER, C, Calendar, exec, omarchy-launch-webapp "https://app.hey.com/calendar/weeks/"|bindd = SUPER, C, Calendar, exec, omarchy-launch-webapp "https://calendar.google.com"|' ~/.config/hypr/bindings.conf | |
| # Remover Signal e Obsidian | |
| sed -i '/bindd = SUPER, G, Signal, exec, uwsm app -- signal-desktop/d' ~/.config/hypr/bindings.conf | |
| sed -i '/bindd = SUPER, O, Obsidian, exec, uwsm app -- obsidian -disable-gpu/d' ~/.config/hypr/bindings.conf | |
| msg "Keybindings personalizados aplicados" | |
| fi | |
| # Configurar Clipse (gerenciador de clipboard) | |
| msg "Configurando Clipse e bindings..." | |
| if [ -f ~/.config/hypr/bindings.conf ]; then | |
| # Adicionar binding para clipse se não existir | |
| if ! grep -q "SHIFT ALT, V" ~/.config/hypr/bindings.conf; then | |
| echo 'bind = SHIFT ALT, V, exec, ghostty --title="Clipse" -e clipse' >> ~/.config/hypr/bindings.conf | |
| msg "Binding Shift+Alt+V para Clipse adicionado" | |
| fi | |
| fi | |
| # Configurar window rules para clipse | |
| if [ -f ~/.config/hypr/windows.conf ]; then | |
| cp ~/.config/hypr/windows.conf ~/.config/hypr/windows.conf.bak | |
| else | |
| touch ~/.config/hypr/windows.conf | |
| fi | |
| # Adicionar window rules para clipse se não existirem | |
| if ! grep -q "title:(Clipse)" ~/.config/hypr/windows.conf; then | |
| cat >> ~/.config/hypr/windows.conf << 'EOF' | |
| # Window Rules para Clipse | |
| windowrulev2 = float,title:(Clipse) | |
| windowrulev2 = size 622 652,title:(Clipse) | |
| windowrulev2 = center,title:(Clipse) | |
| EOF | |
| msg "Window rules para Clipse adicionadas" | |
| fi | |
| # Configurar autostart do clipse | |
| if [ -f ~/.config/hypr/autostart.conf ]; then | |
| if ! grep -q "clipse -listen" ~/.config/hypr/autostart.conf; then | |
| echo "exec-once = clipse -listen" >> ~/.config/hypr/autostart.conf | |
| msg "Clipse adicionado ao autostart do Hyprland" | |
| fi | |
| else | |
| echo "exec-once = clipse -listen" > ~/.config/hypr/autostart.conf | |
| msg "Arquivo autostart.conf criado com clipse" | |
| fi | |
| # Iniciar clipse daemon se não estiver rodando | |
| if ! pgrep -f "wl-paste.*clipse" > /dev/null; then | |
| msg "Iniciando daemon do Clipse..." | |
| clipse -listen & | |
| fi | |
| # 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 | |
| # Key bindings for Home and End keys | |
| bindkey "^[[H" beginning-of-line | |
| bindkey "^[[F" end-of-line | |
| bindkey "^[[1~" beginning-of-line | |
| bindkey "^[[4~" end-of-line | |
| 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 | |
| # VSCode | |
| msg "Instalando VSCode..." | |
| yay -S --noconfirm visual-studio-code-bin | |
| # 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 | |
| # Aplicativos desktop | |
| msg "Instalando aplicativos desktop..." | |
| yay -S --noconfirm \ | |
| mission-center discord dbeaver gnome-calculator flatseal \ | |
| bitwarden zapzap-git joplin-desktop normcap textpieces \ | |
| cpu-x localsend-bin clipse \ | |
| || warn "Falha ao instalar alguns aplicativos desktop." | |
| # Configurar permissões Flatpak para Wayland | |
| if command -v flatpak &> /dev/null; then | |
| msg "Configurando permissões Flatpak para Wayland e clipboard..." | |
| # Habilitar socket Wayland e IPC para todos os apps Flatpak | |
| sudo flatpak override --system --socket=wayland --share=ipc --filesystem="/run/user/$UID/wayland-0" | |
| # Adicionar socket X11 e variáveis de ambiente para compatibilidade | |
| sudo flatpak override --system --socket=x11 --env=GDK_BACKEND=wayland,x11 --env=QT_QPA_PLATFORM="wayland;xcb" | |
| msg "Permissões Flatpak configuradas para melhor integração com Wayland" | |
| else | |
| warn "Flatpak não encontrado - pule as configurações de permissão" | |
| fi | |
| # Terminal e editor | |
| msg "Instalando Ghostty..." | |
| yay -S --noconfirm ghostty || warn "Falha ao instalar terminal." | |
| #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 | |
| sudo chmod +x /usr/local/bin/overmind | |
| # Aplicativos extras | |
| msg "Instalando browsers e utilidades..." | |
| yay -S --noconfirm \ | |
| balena-etcher brave-bin fastfetch microsoft-edge-stable-bin \ | |
| || warn "Falha ao instalar alguns aplicativos extras." | |
| # Configurar browsers para usar X11 com scaling correto | |
| msg "Configurando browsers para usar X11 com scaling correto..." | |
| # Chrome | |
| if [ -f "/usr/share/applications/google-chrome.desktop" ]; then | |
| # Copiar e modificar desktop do Chrome | |
| cp /usr/share/applications/google-chrome.desktop ~/.local/share/applications/ | |
| sed -i 's|--enable-features=UseOzonePlatform --ozone-platform=wayland|--ozone-platform=x11 --force-device-scale-factor=1|g' ~/.local/share/applications/google-chrome.desktop | |
| msg "Chrome configurado para X11 com scale factor 1" | |
| fi | |
| # Chromium | |
| if [ -f "/usr/share/applications/chromium.desktop" ]; then | |
| # Copiar e modificar desktop do Chromium | |
| cp /usr/share/applications/chromium.desktop ~/.local/share/applications/ | |
| sed -i 's|Exec=/usr/bin/chromium|Exec=/usr/bin/chromium --ozone-platform=x11 --force-device-scale-factor=1|g' ~/.local/share/applications/chromium.desktop | |
| msg "Chromium configurado para X11 com scale factor 1" | |
| fi | |
| # Edge Flatpak | |
| if flatpak list --app 2>/dev/null | grep -q "com.microsoft.Edge"; then | |
| cat > ~/.local/share/applications/com.microsoft.Edge.desktop << 'EOF' | |
| [Desktop Entry] | |
| Version=1.0 | |
| Name=Microsoft Edge | |
| GenericName=Web Browser | |
| Comment=Access the Internet | |
| Exec=flatpak run --command=sh com.microsoft.Edge -c "/app/bin/edge --ozone-platform=x11 --force-device-scale-factor=1 \"\$@\"" -- %U | |
| StartupNotify=true | |
| Terminal=false | |
| Icon=com.microsoft.Edge | |
| StartupWMClass=microsoft-edge | |
| Type=Application | |
| Categories=Network;WebBrowser; | |
| MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/ftp;x-scheme-handler/http;x-scheme-handler/https; | |
| Actions=new-window;new-private-window; | |
| [Desktop Action new-window] | |
| Name=New Window | |
| Exec=flatpak run --command=sh com.microsoft.Edge -c "/app/bin/edge --ozone-platform=x11 --force-device-scale-factor=1" | |
| [Desktop Action new-private-window] | |
| Name=New InPrivate Window | |
| Exec=flatpak run --command=sh com.microsoft.Edge -c "/app/bin/edge --ozone-platform=x11 --force-device-scale-factor=1 --inprivate" | |
| EOF | |
| msg "Edge Flatpak configurado para X11 com scale factor 1" | |
| fi | |
| # Omarchy webapp launcher | |
| if [ -f "$HOME/.local/share/omarchy/bin/omarchy-launch-webapp" ]; then | |
| sed -i 's|--app="\$1"|--ozone-platform=x11 --force-device-scale-factor=1 --app="\$1"|' ~/.local/share/omarchy/bin/omarchy-launch-webapp | |
| msg "Omarchy webapp launcher configurado para X11 com scale factor 1" | |
| fi | |
| # Omarchy browser launcher | |
| if [ -f "$HOME/.local/share/omarchy/bin/omarchy-launch-browser" ]; then | |
| sed -i 's|\${args\[@\]} \$@|--ozone-platform=x11 --force-device-scale-factor=1 \${args[@]} \$@|' ~/.local/share/omarchy/bin/omarchy-launch-browser | |
| msg "Omarchy browser launcher configurado para X11 com scale factor 1" | |
| fi | |
| # Adicionar binding para Edge no Hyprland | |
| if [ -f "$HOME/.config/hypr/bindings.conf" ]; then | |
| if ! grep -q "SUPER SHIFT, B" ~/.config/hypr/bindings.conf; then | |
| sed -i '/bindd = SUPER, B, Browser, exec, \$browser/a\ | |
| bindd = SUPER SHIFT, B, Edge, exec, flatpak run --command=sh com.microsoft.Edge -c "/app/bin/edge --ozone-platform=x11 --force-device-scale-factor=1"' ~/.config/hypr/bindings.conf | |
| msg "Binding Super+Shift+B para Edge adicionado ao Hyprland" | |
| fi | |
| fi | |
| # 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 | |
| #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: yay -S 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 | |
| # Configurar montagem NFS no fstab | |
| msg "Configurando montagem NFS no fstab..." | |
| # Instalar cliente NFS se não estiver instalado | |
| if ! systemctl is-enabled rpc-statd.service &>/dev/null; then | |
| msg "Habilitando serviços NFS..." | |
| sudo systemctl enable rpc-statd.service | |
| sudo systemctl start rpc-statd.service | |
| fi | |
| # Criar diretório de montagem se não existir | |
| sudo mkdir -p /media/alex/backup | |
| sudo chown alex:alex /media/alex/backup | |
| # 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" | |
| else | |
| msg "Entrada NFS já existe no fstab" | |
| fi | |
| # Recarregar systemd para reconhecer as novas montagens automáticas | |
| sudo systemctl daemon-reload | |
| # Configurar bookmark do Nautilus para NFS | |
| msg "Configurando bookmark do Nautilus para NFS..." | |
| mkdir -p ~/.config/gtk-3.0 | |
| if ! grep -q "file:///media/alex/backup" ~/.config/gtk-3.0/bookmarks 2>/dev/null; then | |
| echo "file:///media/alex/backup Backup NFS" >> ~/.config/gtk-3.0/bookmarks | |
| msg "Bookmark NFS adicionado ao Nautilus" | |
| fi | |
| # Reiniciar GVFS daemon para evitar conflitos de mount | |
| msg "Reiniciando GVFS daemon..." | |
| systemctl --user restart gvfs-daemon 2>/dev/null || true | |
| # Testar montagem manualmente | |
| msg "Testando montagem NFS..." | |
| if sudo mount -t nfs4 192.168.0.116:/volume1/Arquivos /media/alex/backup; then | |
| msg "Montagem NFS4 bem-sucedida" | |
| sudo umount /media/alex/backup | |
| else | |
| warn "Falha na montagem NFS - verifique se o servidor NFS está acessível e as permissões estão corretas" | |
| fi | |
| # Configurar file chooser para mostrar diretórios primeiro | |
| msg "Configurando file chooser para mostrar diretórios primeiro..." | |
| gsettings set org.gtk.Settings.FileChooser sort-directories-first true | |
| gsettings set org.gtk.gtk4.Settings.FileChooser sort-directories-first true | |
| yay -Yc --noconfirm | |
| msg "Acabou! Faça um boot ou logout para aplicar as configurações do zsh!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment