#!/usr/bin/env bash # universal/essential-packages hash: {{ include (joinPath ".chezmoitemplates" "universal" "essential-packages") | sha256sum }} {{ includeTemplate "universal/logg" }} {{- $packages := splitList " " (includeTemplate "universal/essential-packages" .) }} if command -v dnf > /dev/null; then logg 'Installing common dependencies using `dnf`' logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}' for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do logg info 'Installing `'"$PACKAGE"'`' sudo dnf install -y "$PACKAGE" || EXIT_CODE=$? if [ -n "$EXIT_CODE" ]; then logg error 'Error installing `'"$PACKAGE"'` via dnf' logg info 'Proceeding with installation..' unset EXIT_CODE fi done else logg 'Installing common dependencies using `yum`' logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}' for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do logg info 'Installing `'"$PACKAGE"'`' sudo yum install -y "$PACKAGE" || EXIT_CODE=$? if [ -n "$EXIT_CODE" ]; then logg error 'Error installing `'"$PACKAGE"'` via yum' logg info 'Proceeding with installation..' unset EXIT_CODE fi done fi