pika-drivers/data/modify-driver.sh

119 lines
4.8 KiB
Bash
Raw Permalink Normal View History

2023-06-29 22:18:36 +02:00
#! /bin/bash
2024-02-20 22:45:07 +01:00
WHO=$(whoami)
if [[ $WHO == "pikaos" ]]; then
if [[ -z $pkg ]] && [[ "$1" = "xone-dkms" ]]
then
pkg="xone-dkms xpadneo-dkms xpad-noone-dkms"
fi
if [[ -z $pkg ]] && [[ "$1" = "vulkan-amdgpu-pro" ]]
then
pkg="vulkan-amdgpu-pro vulkan-amdgpu-pro:i386"
fi
if [[ -z $pkg ]] && [[ "$1" = "amf-amdgpu-pro" ]]
then
pkg="amf-amdgpu-pro vulkan-amdgpu-pro vulkan-amdgpu-pro:i386"
fi
if [[ -z $pkg ]] && [[ "$1" = "amdvlk" ]]
then
pkg="amdvlk amdvlk:i386"
fi
if [[ -z $pkg ]] && [[ "$1" = "opencl-legacy-amdgpu-pro-icd" ]]
then
pkg="ocl-icd-libopencl1-amdgpu-pro ocl-icd-libopencl1-amdgpu-pro:i386 opencl-legacy-amdgpu-pro-icd opencl-legacy-amdgpu-pro-icd:i386"
fi
if [[ -z $pkg ]] && [[ "$1" = "amdgpu-pro-oglp" ]]
then
pkg="amdgpu-pro-oglp amdgpu-pro-oglp:i386"
fi
if [[ -z $pkg ]]
then
pkg="$1"
fi
2024-09-02 02:50:07 +02:00
if /usr/lib/pika/drivers/check-pkg.sh "$1"
2024-02-20 22:45:07 +01:00
then
if echo $pkg | grep -i mesa
then
zenity --error --text "the following driver "$1" can not be removed only swapped"
else
2024-02-26 16:02:47 +01:00
echo "pikaos" | sudo -S bash -c "DEBIAN_FRONTEND=noninteractive apt remove $pkg -y -o Dpkg::Options::='--force-confnew' && sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y -o Dpkg::Options::='--force-confnew'"
2024-02-20 22:45:07 +01:00
fi
else
if echo $pkg | grep -i nvidia
then
2024-02-26 16:02:47 +01:00
echo "pikaos" | sudo -S bash -c "DEBIAN_FRONTEND=noninteractive apt update -y -o Dpkg::Options::='--force-confnew' && DEBIAN_FRONTEND=noninteractive apt purge nvidia-driver-* -y -o Dpkg::Options::='--force-confnew' && DEBIAN_FRONTEND=noninteractive apt install $pkg -y -o Dpkg::Options::='--force-confnew' && sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y -o Dpkg::Options::='--force-confnew'"
2024-02-20 22:45:07 +01:00
else
if echo $pkg | grep -i mesa-hybrid
then
2024-02-26 16:02:47 +01:00
echo "pikaos" | sudo -S bash -c "DEBIAN_FRONTEND=noninteractive apt update -y -o Dpkg::Options::='--force-confnew' && DEBIAN_FRONTEND=noninteractive apt install mesa-stable -y -o Dpkg::Options::='--force-confnew' && DEBIAN_FRONTEND=noninteractive apt install mesa-hybrid -y -o Dpkg::Options::='--force-confnew' && sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y -o Dpkg::Options::='--force-confnew'"
2024-02-20 22:45:07 +01:00
else
2024-02-26 16:02:47 +01:00
echo "pikaos" | sudo -S bash -c "DEBIAN_FRONTEND=noninteractive apt update -y -o Dpkg::Options::='--force-confnew' && DEBIAN_FRONTEND=noninteractive apt install $pkg -y -o Dpkg::Options::='--force-confnew' && sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y -o Dpkg::Options::='--force-confnew'"
2024-02-20 22:45:07 +01:00
fi
fi
fi
else
2023-06-29 22:30:10 +02:00
if [[ -z $pkg ]] && [[ "$1" = "xone-dkms" ]]
then
pkg="xone-dkms xpadneo-dkms xpad-noone-dkms"
fi
if [[ -z $pkg ]] && [[ "$1" = "vulkan-amdgpu-pro" ]]
then
pkg="vulkan-amdgpu-pro vulkan-amdgpu-pro:i386"
fi
if [[ -z $pkg ]] && [[ "$1" = "amf-amdgpu-pro" ]]
then
pkg="amf-amdgpu-pro vulkan-amdgpu-pro vulkan-amdgpu-pro:i386"
fi
if [[ -z $pkg ]] && [[ "$1" = "amdvlk" ]]
then
pkg="amdvlk amdvlk:i386"
fi
if [[ -z $pkg ]] && [[ "$1" = "opencl-legacy-amdgpu-pro-icd" ]]
then
pkg="ocl-icd-libopencl1-amdgpu-pro ocl-icd-libopencl1-amdgpu-pro:i386 opencl-legacy-amdgpu-pro-icd opencl-legacy-amdgpu-pro-icd:i386"
fi
if [[ -z $pkg ]] && [[ "$1" = "amdgpu-pro-oglp" ]]
then
pkg="amdgpu-pro-oglp amdgpu-pro-oglp:i386"
fi
if [[ -z $pkg ]]
then
pkg="$1"
fi
2024-09-02 02:50:07 +02:00
if /usr/lib/pika/drivers/check-pkg.sh "$1"
2023-06-29 22:18:36 +02:00
then
2023-08-14 14:41:42 +02:00
if echo $pkg | grep -i mesa
then
zenity --error --text "the following driver "$1" can not be removed only swapped"
else
2024-02-26 16:02:47 +01:00
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY bash -c "DEBIAN_FRONTEND=noninteractive apt remove $pkg -y -o Dpkg::Options::='--force-confnew' && sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y -o Dpkg::Options::='--force-confnew'"
2023-08-14 14:41:42 +02:00
fi
2023-06-29 22:18:36 +02:00
else
if echo $pkg | grep -i nvidia
2023-07-13 14:33:13 +02:00
then
2024-07-23 23:34:32 +02:00
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY bash -c "DEBIAN_FRONTEND=noninteractive apt update -y -o Dpkg::Options::='--force-confnew' && DEBIAN_FRONTEND=noninteractive apt purge nvidia-driver-* nvidia-open-driver-* -y -o Dpkg::Options::='--force-confnew' && DEBIAN_FRONTEND=noninteractive apt install $pkg -y -o Dpkg::Options::='--force-confnew' && sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y -o Dpkg::Options::='--force-confnew'"
else
2023-08-14 14:41:42 +02:00
if echo $pkg | grep -i mesa-hybrid
then
2024-02-26 16:02:47 +01:00
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY bash -c "DEBIAN_FRONTEND=noninteractive apt update -y -o Dpkg::Options::='--force-confnew' && DEBIAN_FRONTEND=noninteractive apt install mesa-stable -y -o Dpkg::Options::='--force-confnew' && DEBIAN_FRONTEND=noninteractive apt install mesa-hybrid -y -o Dpkg::Options::='--force-confnew' && sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y -o Dpkg::Options::='--force-confnew'"
2023-08-14 14:41:42 +02:00
else
2024-02-26 16:02:47 +01:00
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY bash -c "DEBIAN_FRONTEND=noninteractive apt update -y -o Dpkg::Options::='--force-confnew' && DEBIAN_FRONTEND=noninteractive apt install $pkg -y -o Dpkg::Options::='--force-confnew' && sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y -o Dpkg::Options::='--force-confnew'"
2023-08-14 14:41:42 +02:00
fi
fi
2023-06-29 22:18:36 +02:00
fi
2024-02-20 22:45:07 +01:00
fi