103 lines
2.5 KiB
Bash
Executable File
103 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
_clean_packages() {
|
|
local _packages_to_remove=""
|
|
|
|
_packages_to_remove+=(
|
|
$(pacman -Qq | grep calamares)
|
|
$(pacman -Qq | grep skel-liveuser)
|
|
arch-install-scripts
|
|
archiso
|
|
ckbcomp
|
|
clonezilla
|
|
gpart
|
|
grsync
|
|
memtest86+
|
|
mkinitcpio
|
|
mkinitcpio-archiso
|
|
mkinitcpio-busybox
|
|
mkinitcpio-nfs-utils
|
|
qemu-arm-aarch64-static-bin
|
|
rate-mirrors
|
|
syslinux
|
|
yaml-cpp
|
|
)
|
|
|
|
local _check_nvidia_card="$(chwd --is_nvidia_card | grep -q 'NVIDIA card found!'; echo $?)"
|
|
if [[ "${_check_nvidia_card}" -ne 0 ]]; then
|
|
echo "No NVIDIA card detected. Removing nvidia drivers"
|
|
_packages_to_remove+=(nvidia-dkms nvidia-utils nvidia-settings egl-wayland)
|
|
# else
|
|
# echo "blacklist nouveau" > /etc/modprobe.d/nouveau-blacklist.conf
|
|
# echo "options nouveau modeset=0" >> /etc/modprobe.d/nouveau-blacklist.conf
|
|
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 -Rsnc "$xx" --noconfirm; done
|
|
}
|
|
|
|
_pacman_fix() {
|
|
pacman-key --init
|
|
pacman-key --populate
|
|
}
|
|
|
|
_remove_pacman_package() {
|
|
local _pkgname="$1"
|
|
pacman -Rsnc "$_pkgname" --noconfirm || true
|
|
}
|
|
|
|
# remove pkgs installed for VMs
|
|
_clean_vm_packages() {
|
|
|
|
#remove virtualbox
|
|
if pacman -Qi virtualbox-guest-utils &> /dev/null; then
|
|
systemctl disable vboxservice.service
|
|
_remove_pacman_package virtualbox-guest-utils
|
|
fi
|
|
|
|
if pacman -Qi virtualbox-guest-utils-nox &> /dev/null; then
|
|
systemctl disable vboxservice.service
|
|
_remove_pacman_package virtualbox-guest-utils-nox
|
|
fi
|
|
|
|
#remove vmware
|
|
if [ -f /etc/xdg/autostart/vmware-user.desktop ]; then
|
|
rm /etc/xdg/autostart/vmware-user.desktop
|
|
fi
|
|
|
|
if pacman -Qi open-vm-tools &> /dev/null; then
|
|
systemctl disable vmtoolsd.service
|
|
_remove_pacman_package open-vm-tools
|
|
fi
|
|
|
|
if [ -f /etc/systemd/system/multi-user.target.wants/vmtoolsd.service ]; then
|
|
rm /etc/systemd/system/multi-user.target.wants/vmtoolsd.service
|
|
fi
|
|
|
|
#remove qemu
|
|
if pacman -Qi qemu-guest-agent &> /dev/null; then
|
|
systemctl disable qemu-guest-agent.service
|
|
_remove_pacman_package qemu-guest-agent
|
|
fi
|
|
}
|
|
|
|
_check_not_running_vm="$(systemd-detect-virt | grep -q 'none'; echo $?)"
|
|
if [[ "${_check_not_running_vm}" -eq 0 ]]; then
|
|
_clean_vm_packages
|
|
fi
|
|
|
|
_remove_archiso_conf() {
|
|
|
|
local _filenames=$(find /etc -type f -name "*archiso*")
|
|
for f in $_filenames
|
|
do
|
|
unlink "${f}"
|
|
done
|
|
}
|
|
|
|
_remove_archiso_conf
|
|
_clean_packages
|
|
_pacman_fix
|