Last active
May 1, 2022 18:54
-
-
Save dpanter/fec6dc0e48f97c5e2128e93d4187228d to your computer and use it in GitHub Desktop.
updatemesagit.sh - Easily update Mesa git from Siduction experimental repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# updatemesagit.sh | |
# Easily update Mesa git from Siduction experimental repo | |
# Created 2020-04-15 - Updated 2022-05-01 | |
# Written for Siduction (Debian sid based distro) | |
# By dpanter https://gist.github.com/dpanter | |
# setting color variables for fancy pants output | |
WHITE='\e[1;37m' | |
RED='\e[0;31m' | |
LRED='\e[1;31m' | |
GREEN='\e[0;32m' | |
LGREEN='\e[1;32m' | |
YELLOW='\e[1;33m' | |
NC='\e[0m' # No Color, ${NC} | |
# sanity check if Siduction experimental repo is actually enabled, else abort | |
CHECKREPO=$(grep -RiH 'siduction' /etc/apt/sources* | grep -E 'deb.*siduction.*experimental' | grep -v "#" | awk -F:deb '{ print "FILE: " $1 " REPO: deb" $2 }') | |
if [ -z "$CHECKREPO" ]; then | |
echo -e "${LRED}\nCannot determine if Siduction experimental repo is enabled." | |
echo -e "This is required for updating mesa git. Check your repos!" | |
echo -e "Update aborted.\n${NC}" | |
exit 1 | |
else | |
echo -e "${LGREEN}\nLooks like Siduction experimental repo is enabled:${NC}" | |
echo -e "${GREEN}$CHECKREPO\n${NC}" | |
fi | |
#update APT cache | |
echo -e "${YELLOW}Updating APT cache, please wait...\n${NC}" | |
sudo apt -qq update 2>/dev/null >/dev/null | |
# check currently installed version | |
MESAINST=$(apt list -i mesa-va-drivers 2>/dev/null | awk -F' ' '/amd64/ { print $2 }') | |
# check most recent version in APT cache | |
MESAUP=$(apt list -a mesa-va-drivers 2>/dev/null | grep -E 'unknown.*git.*amd64' | awk -F' ' '/git/ { print $2 }') | |
# check if update is possible, else abort | |
if [ "$MESAUP" == "$MESAINST" ]; then | |
echo -e "${WHITE}Already using latest version in cache: ${LGREEN}$MESAINST\n${NC}" | |
else | |
# present versions and give choice to update | |
echo -e "Installed version: ${GREEN}$MESAINST${NC}" | |
echo -e " Update available: ${LGREEN}$MESAUP${NC}" | |
read -n 1 -p "Apply update? Press y to proceed. " input | |
echo "" | |
# watch for input "y" to update, else abort | |
if [[ $input == y ]]; then | |
sudo apt install {mesa-va-drivers,mesa-va-drivers:i386,mesa-vdpau-drivers,mesa-vdpau-drivers:i386,mesa-vulkan-drivers,mesa-vulkan-drivers:i386,libglapi-mesa,libglapi-mesa:i386,libglx-mesa0,libglx-mesa0:i386,libegl-mesa0,libegl-mesa0:i386,libgbm1,libgbm1:i386,libgl1-mesa-dri,libgl1-mesa-dri:i386}="$MESAUP" | |
else | |
echo -e "${LRED}Update aborted.\n${NC}" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment