mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 11:32:42 +00:00
44 lines
1.4 KiB
Cheetah
44 lines
1.4 KiB
Cheetah
#!/bin/sh
|
|||
|
|
# Install packages declared in .chezmoidata/packages.yaml.
|
||
|
|
# packages.yaml hash: {{ include ".chezmoidata/packages.yaml" | sha256sum }}
|
||
|
|
set -eu
|
||
|
|
|
||
|
|
{{ if eq .chezmoi.os "linux" -}}
|
||
|
|
if [ "$(id -u)" -eq 0 ]; then PACMAN="pacman"; else PACMAN="sudo pacman"; fi
|
||
|
|
|
||
|
|
# shellcheck disable=SC2086 # word splitting intended
|
||
|
|
$PACMAN -S --needed --noconfirm \
|
||
|
|
{{ range .packages.arch.pacman }} {{ . }} \
|
||
|
|
{{ end }} && true
|
||
|
|
|
||
|
|
{{ if or (eq .role "desktop") (eq .role "laptop") -}}
|
||
|
|
$PACMAN -S --needed --noconfirm \
|
||
|
|
{{ range .packages.arch.desktop.pacman }} {{ . }} \
|
||
|
|
{{ end }} && true
|
||
|
|
|
||
|
|
aur_pkgs="{{ range .packages.arch.desktop.aur }}{{ . }} {{ end }}{{ range .packages.arch.aur }}{{ . }} {{ end }}"
|
||
|
|
{{ else -}}
|
||
|
|
aur_pkgs="{{ range .packages.arch.aur }}{{ . }} {{ end }}"
|
||
|
|
{{ end -}}
|
||
|
|
if [ -n "$(echo "$aur_pkgs" | tr -d ' ')" ]; then
|
||
|
|
if command -v paru >/dev/null 2>&1; then
|
||
|
|
# shellcheck disable=SC2086
|
||
|
|
paru -S --needed --noconfirm $aur_pkgs
|
||
|
|
else
|
||
|
|
echo "warning: paru not found — skipping AUR packages: $aur_pkgs" >&2
|
||
|
|
fi
|
||
|
|
fi
|
||
|
|
|
||
|
|
{{ else if eq .chezmoi.os "darwin" -}}
|
||
|
|
if ! command -v brew >/dev/null 2>&1; then
|
||
|
|
echo "error: homebrew not installed — https://brew.sh" >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
brew install \
|
||
|
|
{{ range .packages.darwin.brew }} {{ . }} \
|
||
|
|
{{ end }} && true
|
||
|
|
|
||
|
|
brew install --cask \
|
||
|
|
{{ range .packages.darwin.cask }} {{ . }} \
|
||
|
|
{{ end }} && true
|
||
|
|
{{ end -}}
|