#!/bin/bash
set -e

sudo pacman -Syu --noconfirm

if ! command -v yay &> /dev/null; then
    sudo pacman -S --needed git base-devel --noconfirm
    git clone https://aur.archlinux.org/yay.git
    cd yay
    makepkg -si --noconfirm
    cd ..
    rm -rf yay
fi

yay -S --noconfirm anydesk

sudo systemctl enable --now anydesk.service

echo "AnyDesk instalado com sucesso!"