diff --git a/protondb.sh b/protondb.sh index 53e5df9..1e71fe4 100755 --- a/protondb.sh +++ b/protondb.sh @@ -7,6 +7,9 @@ rm -rf /tmp/proton-ge-custom mkdir /tmp/proton-ge-custom cd /tmp/proton-ge-custom +echo 'Creating Steam directory if it does not exist...' +mkdir -p ~/.steam/root/compatibilitytools.d + echo 'Getting ProtonGE metadata' METADATA=$(curl -s https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest | grep browser_download_url | cut -d\" -f4) test -n "$METADATA" @@ -15,6 +18,8 @@ test -n "$METADATA" echo 'Fetching tarball URL...' TARBALL_URL=$(echo "$METADATA" | grep .tar.gz) TARBALL_NAME=$(basename "$TARBALL_URL") +VERSION_NAME=$(echo "$TARBALL_NAME" | sed 's/.tar.gz//') +test -d ~/.steam/root/compatibilitytools.d/"$VERSION_NAME" && echo "Version $VERSION_NAME already present, aborting" && exit 0 echo "Downloading tarball: $TARBALL_NAME..." curl -# -L "$TARBALL_URL" -o "$TARBALL_NAME" --no-progress-meter @@ -28,9 +33,6 @@ echo "Verifying tarball $TARBALL_NAME with checksum $CHECKSUM_NAME..." sha512sum -c "$CHECKSUM_NAME" # If result is ok, continue -echo 'Creating Steam directory if it does not exist...' -mkdir -p ~/.steam/root/compatibilitytools.d - echo "Extracting $TARBALL_NAME to Steam directory..." tar -xf "$TARBALL_NAME" -C ~/.steam/root/compatibilitytools.d/ echo 'All done :)'