2023-01-09 10:28:15 -08:00
|
|
|
{{- if eq .host.distro.family "linux" -}}
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
{{- $removePackages := splitList " " .removeLinuxPackages }}
|
|
|
|
|
|
|
|
### Remove bloatware packages defined in .chezmoidata.yaml
|
|
|
|
for PKG in {{ $removePackages }}; do
|
|
|
|
if command -v apt-get > /dev/null; then
|
|
|
|
if dpkg -l "$PKG" | grep "$PKG"; then
|
|
|
|
sudo apt-get remove -y "$PKG"
|
|
|
|
fi
|
|
|
|
elif command -v dnf > /dev/null; then
|
2023-01-09 10:33:22 -08:00
|
|
|
if rpm -qa | grep "$PKG" > /dev/null; then
|
|
|
|
sudo dnf remove -y "$PKG"
|
|
|
|
fi
|
2023-01-09 10:28:15 -08:00
|
|
|
elif command -v yum > /dev/null; then
|
2023-01-09 10:33:22 -08:00
|
|
|
if rpm -qa | grep "$PKG" > /dev/null; then
|
|
|
|
sudo yum remove -y "$PKG"
|
|
|
|
fi
|
2023-01-09 10:28:15 -08:00
|
|
|
elif command -v pacman > /dev/null; then
|
|
|
|
if pacman -Qs "$PKG" > /dev/null; then
|
|
|
|
sudo pacman -R "$PKG"
|
|
|
|
fi
|
2023-01-09 10:33:22 -08:00
|
|
|
elif command -v zypper > /dev/null; then
|
|
|
|
if rpm -qa | grep "$PKG" > /dev/null; then
|
|
|
|
sudo zypper remove -y "$PKG"
|
|
|
|
fi
|
2023-01-09 10:28:15 -08:00
|
|
|
fi
|
2023-01-09 10:33:22 -08:00
|
|
|
done
|
|
|
|
|
|
|
|
{{- end }}
|