Skip to content

Instantly share code, notes, and snippets.

@lajosbencz
Created September 19, 2017 13:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lajosbencz/273c75056744143f57714504637307c8 to your computer and use it in GitHub Desktop.
Save lajosbencz/273c75056744143f57714504637307c8 to your computer and use it in GitHub Desktop.
Downloads and installs latest AMDGPU-PRO drivers from the official AMD website
#!/bin/bash
# amdgpu-pro-wizard.sh
# Downloads and installs latest AMDGPU-PRO drivers from the official AMD website
URL="http://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Driver-for-Linux-Release-Notes.aspx"
DIR="/tmp/.amdgpu-pro-install-9811a15y85p71m/"
HTML="list.html"
PAT="www2.ati.com/drivers/linux"
REF="http://support.amd.com"
# Change to a temporary folder
mkdir -p $DIR
cd $DIR
# Dowload the HTML page
wget -q -O $HTML $URL
# Extract link lines
list=$(cat $HTML | grep $PAT | sed -n "/href/ s/.*href=['\"]\([^'\"]*\)['\"]>\([^<]*\).*/\1>\2/gp" | sed "s/&#58;/\:/g")
titles=()
links=()
options=()
url_of_title()
{
for i in "${!titles[@]}"; do
if [[ "${titles[$i]}" = "$1" ]]; then
echo "${links[$i]}"
fi
done
}
# Parse links
_IFS="$IFS"
IFS=$'\n'
for line in $list; do
IFS='>'
arr=($line)
links+=(${arr[0]})
titles+=(${arr[1]})
options+=(${arr[1]})
done
IFS="$_IFS"
# Display menu
options+=("Exit")
select choice in "${options[@]}"
do
case $choice in
"Exit")break;;
*)
url=$(url_of_title "$choice")
echo "Downloading:"
echo $url
wget -q --referer=$REF $url &&
tar xf amdgpu-pro-*.tar.xz
echo "Installing:"
echo $choice
cd amdgpu-pro-* &&
./amdgpu-pro-install -y
break
;;
esac
done
# Clean up
cd ~
rm -fr $DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment