Update 7 files

- /home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.tmpl
- /home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-dependencies.tmpl
- /home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl
- /home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl
- /home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-dependencies.tmpl
- /home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl
- /home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl
This commit is contained in:
Brian Zalewski 2023-01-05 02:15:16 +00:00
parent fd19e7d78b
commit 86716c4042
7 changed files with 88 additions and 50 deletions

View file

@ -9,16 +9,23 @@
{{- $additionalPackages := splitList " " (includeTemplate "archlinux/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Print dependency list
logg 'Installing common dependencies using `pacman`'
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 'Installing `'"$PACKAGE"'`'
sudo pacman -Sy --noconfirm --needed "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via pacman'
logg info 'Proceeding with installation..'
unset EXIT_CODE
logg info 'Checking for presence of `'"$PACKAGE"'`'
if pacman -Qs "$PACKAGE" > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo pacman -Sy --noconfirm --needed "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via pacman'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done

View file

@ -9,30 +9,29 @@
{{- $additionalPackages := splitList " " (includeTemplate "centos/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Detect package manager
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
PKG_MANAGER='dnf'
else
logg 'Installing common dependencies using `yum`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
PKG_MANAGER='yum'
fi
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
### 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 yum install -y "$PACKAGE" || EXIT_CODE=$?
sudo "$PKG_MANAGER" install -y "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via yum'
logg error 'Error installing `'"$PACKAGE"'` via `'"$PKG_MANAGER"'`'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
done
fi
fi
done

View file

@ -9,17 +9,26 @@
{{- $additionalPackages := splitList " " (includeTemplate "debian/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Print dependency list
logg 'Installing common dependencies using `apt-get`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Update apt-get cache
logg info 'Running `sudo apt-get update`'
sudo apt-get update
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Installing `'"$PACKAGE"'`'
sudo apt-get install -y --no-install-recommends "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via apt-get'
logg info 'Proceeding with installation..'
unset EXIT_CODE
logg info 'Checking for presence of `'"$PACKAGE"'`'
if dpkg -l "$PACKAGE" | grep -E '^ii' > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo apt-get install -y --no-install-recommends "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via apt-get'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done

View file

@ -9,15 +9,22 @@
{{- $additionalPackages := splitList " " (includeTemplate "fedora/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Print dependency list
logg 'Installing common dependencies using `dnf`'
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 '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
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 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
fi
done

View file

@ -9,6 +9,7 @@
{{- $additionalPackages := splitList " " (includeTemplate "freebsd/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Print dependency list
logg 'Installing common dependencies using `pkg`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'

View file

@ -9,6 +9,7 @@
{{- $additionalPackages := splitList " " (includeTemplate "opensuse/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Print dependency list
logg 'Installing common dependencies using `zypper`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
@ -16,13 +17,18 @@ logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
logg info 'Installing base_devel pattern with `sudo zypper install -t pattern devel_basis`'
sudo zypper install -t pattern devel_basis
### Install base dependencies
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Installing `'"$PACKAGE"'`'
sudo zypper install -y "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via zypper'
logg info 'Proceeding with installation..'
unset EXIT_CODE
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 zypper install -y "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via zypper'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done

View file

@ -9,17 +9,26 @@
{{- $additionalPackages := splitList " " (includeTemplate "ubuntu/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Print dependency list
logg 'Installing common dependencies using `apt-get`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Update apt-get cache
logg info 'Running `sudo apt-get update`'
sudo apt-get update
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Installing `'"$PACKAGE"'`'
sudo apt-get install -y --no-install-recommends "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via apt-get'
logg info 'Proceeding with installation..'
unset EXIT_CODE
logg info 'Checking for presence of `'"$PACKAGE"'`'
if dpkg -l "$PACKAGE" | grep -E '^ii' > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo apt-get install -y --no-install-recommends "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via apt-get'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done