proton-ge-custom-updater icon indicating copy to clipboard operation
proton-ge-custom-updater copied to clipboard

Version selector

Open moddie666 opened this issue 4 years ago • 0 comments

not really sure how to simply send some changes/extra code, so here goes: added a version selector to proton-ge-custom-updater.sh. mostly just wrapped your code into a loop through selected urls, from the selector function. this version requires bash (or maybe similary feature rich shells) because i did not want to figure out, how to do it without bash-isms ... :D hope you may find some of this useful ;)

#!/bin/bash

# Installation routine
install() {
<UNCHANGED />
}

selections(){
   num=0
   echo
   for u in $RELEASE_URLS
   do if [ "$num" = "$press" ]
      then if [ "x$(egrep "^$u\$" .selections)" = "x" ]
           then #add selection
                echo "$u" >> .selections
           else #remove selection
                egrep -v "^$u\$" .selections > .sel
                mv .sel .selections
           fi
      fi
      if [ "x$(egrep "^$u\$" .selections)" != "x" ]
      then echo "(x)[$num] $(echo "$u" | sed "s|.*/||")"
      else echo "( )[$num] $(echo "$u" | sed "s|.*/||")"
      fi
      num=$(($num+1))
   done
   echo "(De)Select by entering a number (enter nothing to start):"
}


#GET tar.gz urls for all releases
RELEASE_URLS=$(curl -s "https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases" | awk -F '"' '/browser_download_url": ".*tar.gz/{print $4}')

press=blaeh
echo -n > .selections
while [ "x$press" != "x" ]
do read -p "--> Proton GE Installer by p-mng, Version Selection - $(selections)" press
done

for url in $(cat .selections)
do filename="$(echo "$url" | sed "s|.*/||")"
   echo "--> [$filename]"
   # Check if steam is installed regularly, either in one of the two locations
   if [ -d "$HOME/.local/share/Steam" ] || [ -d "$HOME/.steam" ]
   then echo "--> Regular Steam installation found. Installing..."
        install "$HOME/.local/share/Steam" || install "$HOME/.steam"
   else echo "--> Steam does not seem to be installed as a regular package. No changes were made."
   fi

   # Check if steam is installed as Flatpak
   if [ -d "$HOME/.var/app/com.valvesoftware.Steam/.local/share/Steam" ] || [ -d "$HOME/.var/app/com.valvesoftware.Steam/.steam" ]
   then echo "--> Flatpak Steam installation found. Installing..."
        install "$HOME/.var/app/com.valvesoftware.Steam/.local/share/Steam" || install "$HOME/.var/app/com.valvesoftware.Steam/.steam"
   else echo "--> Steam does not seem to be installed as Flatpak. No changes were made."
   fi
done

moddie666 avatar Aug 31 '21 21:08 moddie666