Files
dotfiles/user/.chezmoiscripts/run_onchange_install-packages.sh.tmpl
Frank Zechert 181b339296 initial commit
2026-07-24 02:44:00 +02:00

38 lines
923 B
Cheetah

#!/usr/bin/bash
# Install software packages required on the system when the package file changes
# packages.yaml hash: {{ include ".chezmoidata/packages.yaml" | sha256sum }}
set -e
[ "${CHEZMOI}" -eq 1 ] || exit 1
function install_yay_system_packages() {
local PACKAGES=("$@")
{{ if eq .chezmoi.osRelease.id "arch" -}}
[ ${#PACKAGES[@]} -gt 0 ] && yay -S --needed "${PACKAGES[@]}"
{{ end -}}
}
declare -a yay_packages
{{ if eq .chezmoi.osRelease.id "arch" -}}
{{ range .packages.arch.yay -}}
yay_packages+=({{ . | quote}})
{{ end -}}
{{ if eq .cpu.intel true -}}
{{ range .packages.arch.intel_cpu.yay -}}
yay_packages+=({{ . | quote}})
{{ end -}}
{{ end -}}
{{ if eq .gpu.intel_i915 true -}}
{{ range .packages.arch.intel_graphics_i915.yay -}}
yay_packages+=({{ . | quote}})
{{ end -}}
{{ end -}}
{{ end -}}
install_yay_system_packages "${yay_packages[@]}"
# vim: ft=template syntax=bash