-
-
Save PackmanDude/61d6920a53b0b7cf60b786459f3b8b24 to your computer and use it in GitHub Desktop.
Update every game's proton version.
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/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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great explanation of the structure of the script:
https://unix.stackexchange.com/a/383864