Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SCRIPT] Remove all Proton GE versions installed, except the latest one #33

Open
IceDBorn opened this issue May 26, 2022 · 4 comments
Open

Comments

@IceDBorn
Copy link

IceDBorn commented May 26, 2022

I'm not aware of a native way of removing all versions of proton GE, except the latest one and as a result I made a bash script that solves this issue.

#!/bin/bash

# Download the latest proton ge version
yes | protonup

# List all proton ge versions (protonup -l), find the latest version (grep -v), remove it from the list and remove any part not associated with the version tag (grep -o)
binaries=$(protonup -l | grep -v "$(protonup --releases | tail -n 1)" | grep -o '^\S*')

if [ -z "$binaries" ]
then
    echo "No proton GE versions to remove..."
else
        while IFS= read -r line ; do
          # Remove "Proton-" from older versions of proton ge, because the uninstaller fails to match the folders
          line="${line//Proton-/}"
          # Remove all proton ge versions, except the latest one
          yes | protonup -r "$line" && printf "\n"
        done <<< "$binaries"
fi
@IceDBorn IceDBorn changed the title [Script] Remove all Proton GE versions installed, except the latest one [SCRIPT] Remove all Proton GE versions installed, except the latest one May 26, 2022
@IceDBorn
Copy link
Author

#12

@alcaitiff
Copy link

Note that the list is now reversed (shows newest first). So in this script you will need to change "tail" for "head".

@alcaitiff
Copy link

alcaitiff commented Mar 27, 2023

I don't know why, but "protonup -l" keeps changing order from time to time.

So I changed my removal script to:

INSTALLED_PROTON=$(protonup -l | sort);
if [ $(echo ${INSTALLED_PROTON} | wc -l) != "1" ]; then
     OLD_VERSION=$(echo ${INSTALLED_PROTON} |head -n 1 |cut -d " " -f1)
     echo "Removing ${OLD_VERSION}"
     protonup -r "${OLD_VERSION}" 
fi;

@AUNaseef
Copy link
Owner

it's not necessary to delete it through protonup, just deleting the folder will do. would be nice to integrate this into protonup tho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants