Update file run_onchange_before_10-remove-bloatware.tmpl
This commit is contained in:
parent
23d2613f3c
commit
f58a6f9c79
1 changed files with 13 additions and 1 deletions
|
@ -1,29 +1,41 @@
|
||||||
{{- if eq .host.distro.family "linux" -}}
|
{{- if eq .host.distro.family "linux" -}}
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
{{ includeTemplate "universal/profile" }}
|
||||||
|
{{ includeTemplate "universal/logg" }}
|
||||||
|
|
||||||
{{- $removePackages := splitList " " .removeLinuxPackages }}
|
{{- $removePackages := splitList " " .removeLinuxPackages }}
|
||||||
|
|
||||||
### Remove bloatware packages defined in .chezmoidata.yaml
|
### Remove bloatware packages defined in .chezmoidata.yaml
|
||||||
for PKG in {{ $removePackages }}; do
|
for PKG in {{ $removePackages }}; do
|
||||||
if command -v apt-get > /dev/null; then
|
if command -v apk > /dev/null; then
|
||||||
|
if apk list "$PKG" | grep "$PKG"; then
|
||||||
|
sudo apk delete "$PKG"
|
||||||
|
fi
|
||||||
|
elif command -v apt-get > /dev/null; then
|
||||||
if dpkg -l "$PKG" | grep "$PKG"; then
|
if dpkg -l "$PKG" | grep "$PKG"; then
|
||||||
sudo apt-get remove -y "$PKG"
|
sudo apt-get remove -y "$PKG"
|
||||||
|
logg success 'Removed `'"$PKG"'` via apt-get'
|
||||||
fi
|
fi
|
||||||
elif command -v dnf > /dev/null; then
|
elif command -v dnf > /dev/null; then
|
||||||
if rpm -qa | grep "$PKG" > /dev/null; then
|
if rpm -qa | grep "$PKG" > /dev/null; then
|
||||||
sudo dnf remove -y "$PKG"
|
sudo dnf remove -y "$PKG"
|
||||||
|
logg success 'Removed `'"$PKG"'` via dnf'
|
||||||
fi
|
fi
|
||||||
elif command -v yum > /dev/null; then
|
elif command -v yum > /dev/null; then
|
||||||
if rpm -qa | grep "$PKG" > /dev/null; then
|
if rpm -qa | grep "$PKG" > /dev/null; then
|
||||||
sudo yum remove -y "$PKG"
|
sudo yum remove -y "$PKG"
|
||||||
|
logg success 'Removed `'"$PKG"'` via yum'
|
||||||
fi
|
fi
|
||||||
elif command -v pacman > /dev/null; then
|
elif command -v pacman > /dev/null; then
|
||||||
if pacman -Qs "$PKG" > /dev/null; then
|
if pacman -Qs "$PKG" > /dev/null; then
|
||||||
sudo pacman -R "$PKG"
|
sudo pacman -R "$PKG"
|
||||||
|
logg success 'Removed `'"$PKG"'` via pacman'
|
||||||
fi
|
fi
|
||||||
elif command -v zypper > /dev/null; then
|
elif command -v zypper > /dev/null; then
|
||||||
if rpm -qa | grep "$PKG" > /dev/null; then
|
if rpm -qa | grep "$PKG" > /dev/null; then
|
||||||
sudo zypper remove -y "$PKG"
|
sudo zypper remove -y "$PKG"
|
||||||
|
logg success 'Removed `'"$PKG"'` via zypper'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue