dotfiles/install_utils

95 lines
2 KiB
Fish
Executable file

#!/usr/bin/env fish
function log -a message
echo \n"--- $message ---"\n
end
set -l distro
set -l uname (uname)
if test $uname = Darwin
set distro mac
else if test -f /etc/os-release
set distro (grep '^ID=' /etc/os-release | string replace 'ID=' '' | string trim -c '"')
else
echo 'Your OS is unsupported. Supported: Arch, Debian, Fedora, Mac (Brew)'
return 1
end
set -l base_pkgs \
fish \
git \
neovim \
tmux \
rsync \
curl \
less \
fzf \
mosh \
lsd \
ripgrep \
bat \
tree-sitter-cli \
nodejs \
zoxide \
git-delta \
stow
set -l mac_pkgs \
$base_pkgs \
fd \
yazi
set -l arch_pkgs \
$base_pkgs \
fd \
yazi \
ttf-nerd-fonts-symbols \
ttf-nerd-fonts-symbols-common \
ttf-nerd-fonts-symbols-mono
set -l debian_pkgs \
$base_pkgs \
fd-find
set -l fedora_pkgs \
$base_pkgs \
fd-find
switch $distro
case mac
log 'Installing packages with Homebrew'
brew install $mac_pkgs
case arch
log 'Installing yay'
sudo pacman --sync --refresh --sysupgrade --noconfirm
and sudo pacman --sync --needed --noconfirm base-devel go bat
or return
test -d yay
or git clone https://aur.archlinux.org/yay.git
and cd yay
and bat PKGBUILD
and read -P 'Continue? (y/N): ' -l ready
and test "$ready" = y; or test "$ready" = Y
and makepkg --syncdeps --install --noconfirm
and cd ..
or return
log 'Installing packages with yay'
yay --sync --noconfirm $arch_pkgs
case debian
log 'Installing packages with APT'
sudo apt-get --quiet --yes update
and sudo apt-get --quiet --yes upgrade
and sudo apt-get --quiet --yes install $debian_pkgs
case fedora
log 'Installing packages with DNF'
sudo dnf upgrade --assumeyes
and sudo dnf --assumeyes install $fedora_pkgs
case '*'
echo 'Your OS is unsupported. Supported: Arch, Debian, Fedora, Mac (Brew)'
return 1
end