install.fairie/home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl
Brian Zalewski a79c561e8d Update 22 files
- /home/.chezmoiscripts/_universal/run_onchange_before_11-install-docker.tmpl
- /home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl
- /home/.chezmoiscripts/_universal/run_onchange_before_10-remove-bloatware.tmpl
- /home/.chezmoiscripts/_universal/run_onchange_before_08-install-zx.tmpl
- /home/.chezmoiscripts/_universal/run_onchange_before_09-ensure-node-version.tmpl
- /home/.chezmoiscripts/universal/run_before_01-decrypt-age-key.tmpl
- /home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl
- /home/.chezmoiscripts/universal/run_onchange_before_05-install-homebrew.tmpl
- /home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.tmpl
- /home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl
- /home/.chezmoiscripts/universal/run_onchange_before_09-ensure-node-version.tmpl
- /home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl
- /home/.chezmoiscripts/centos/run_onchange_before_05-upgrade.tmpl
- /home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl
- /home/.chezmoitemplates/universal/common-dependencies
- /home/.chezmoitemplates/universal/profile-inline
- /home/.chezmoitemplates/ubuntu/common-dependencies
- /home/.chezmoitemplates/opensuse/common-dependencies
- /home/.chezmoitemplates/freebsd/common-dependencies
- /home/.chezmoitemplates/fedora/common-dependencies
- /home/.chezmoitemplates/debian/common-dependencies
- /home/.chezmoitemplates/archlinux/common-dependencies
2023-01-31 05:43:15 +00:00

37 lines
1.4 KiB
Bash

#!/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-before" }}
{{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}}
{{- $additionalPackages := splitList " " (includeTemplate "centos/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Detect package manager
if command -v dnf > /dev/null; then
PKG_MANAGER='dnf'
else
PKG_MANAGER='yum'
fi
### Print dependency list
logg 'Installing common dependencies using `'"$PKG_MANAGER"'`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if rpm -qa | grep "^$PACKAGE-" > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo "$PKG_MANAGER" install -y "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via `'"$PKG_MANAGER"'`'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done