Skip to content

Instantly share code, notes, and snippets.

@PackmanDude
Forked from usrtrv/update_proton.sh
Last active August 3, 2024 12:14
Show Gist options
  • Save PackmanDude/61d6920a53b0b7cf60b786459f3b8b24 to your computer and use it in GitHub Desktop.
Save PackmanDude/61d6920a53b0b7cf60b786459f3b8b24 to your computer and use it in GitHub Desktop.
Update every game's proton version.
#!/bin/sh
set -eu
steam_dir="$HOME/.steam"
proton=
list=false
eval set -- "$(getopt -o d:p:l -l directory,proton,list -- "$@")"
while true; do
case "$1" in
-d|--directory)
steam_dir="$2"
shift 2;;
-p|--proton)
proton="$2"
shift 2;;
-l|--list)
list=true
shift;;
--)
shift
break;;
*)
echo "Invalid option: $1"
exit 1
esac
done
# Grab all the library folders
dirs=$(grep -o '/.*' "$steam_dir/steam/steamapps/libraryfolders.vdf" | tr -d '"')
(IFS='
'
for dir in $dirs; do
printf "Found library at '%s'\n" "$dir"
if [ "$proton" ]
then
sed -i "1s/.*/$proton/" "$dir"/steamapps/compatdata/*/version
fi
if [ "$list" = true ]
then
head -1 "$dir"/steamapps/compatdata/*/version
fi
done)
@PackmanDude
Copy link
Author

PackmanDude commented Feb 22, 2023

Great explanation of the structure of the script:
https://unix.stackexchange.com/a/383864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment