🧹 remove nvidia drivers during offline install, if no nvidia was detected

This commit is contained in:
Vladislav Nepogodin committed 2023-03-04 01:32:05 +04:00
1 parent 11d94f6df4
commit 565ea9a8ff
1 file changed
+16 -2
+16 -2
View File
@@ -9,11 +9,11 @@ _clean_files() {
/usr/local/bin/prepare-live-desktop.sh
/usr/local/bin/removeun-online
)
local xx
for xx in "${_files_to_remove[@]}"; do rm -f "$xx" || true; done
}
# taken from Erik Dubois script
_clean_packages() {
local _packages_to_remove=(
gparted
@@ -37,11 +37,25 @@ _clean_packages() {
memtest86+
mkinitcpio-archiso
)
local _nvidia_packages_to_remove=(nvidia-dkms nvidia-utils)
local _check_nvidia_card="$(mhwd --is_nvidia_card | grep -q 'NVIDIA card found!'; echo $?)"
if [[ "${_check_nvidia_card}" -ne 0 ]]; then
echo "No NVIDIA card detected. Removing nvidia drivers"
local xx
# @ does one by one to avoid errors in the entire process
# * can be used to treat all packages in one command
for xx in "${_nvidia_packages_to_remove[@]}"; do pacman -Rc "$xx" --noconfirm; done
fi
local xx
# @ does one by one to avoid errors in the entire process
# taken from Erik Dubois script
for xx in "${_packages_to_remove[@]}"; do pacman -Rsc "$xx" --noconfirm; done
}
_clean_packages
_clean_files
# vim:set ft=bash sw=2 sts=2 et: