Files
dotfiles/.chezmoiscripts/run_onchange_install-packages.sh.tmpl
T
2026-04-21 02:35:50 +03:00

36 lines
580 B
Cheetah
Executable File

#!/bin/bash
{{ if -eq .chezmoi.osRelease.id "nixos" }}
exit 0
{{ end }}
set -euo pipefail
echo "Installing and updating packages..."
{{ if eq .chezmoi.osRelease.idLike "arch" }}
sudo pacman -Sy --noconfirm
pkgs=()
{{ range .packages.arch }}
pkgs+=("{{ . }}")
{{ end }}
if [[ ${#pkgs[@]} -gt 0 ]]; then
echo "Installing pacman packages"
sudo pacman -S --noconfirm "${pkgs[@]}"
fi
pkgs=()
{{ range .packages.aur }}
pkgs+=("{{ . }}")
{{ end }}
if [[ ${#pkgs[@]} -gt 0 ]]; then
echo "Installing AUR packages"
paru -S --noconfirm "${pkgs[@]}"
fi
{{ end }}
echo "Done"