#!/usr/bin/env bash # universal/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "universal" "common-dependencies") | sha256sum }} # centos/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "centos" "common-dependencies") | sha256sum }} {{ includeTemplate "universal/logg" }} {{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}} {{- $additionalPackages := splitList " " (includeTemplate "centos/common-dependencies" .) -}} {{- $packages = concat $packages $additionalPackages -}} 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