Skip to content

Commit

Permalink
Use sed wildcards instead of grepping for common values
Browse files Browse the repository at this point in the history
  • Loading branch information
Pilcrow182 committed Mar 25, 2023
1 parent 7ccbc1a commit bb1874a
Showing 1 changed file with 4 additions and 42 deletions.
46 changes: 4 additions & 42 deletions install-RefreshRateUnlocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,8 @@ else
sudo cp /bin/gamescope-session /bin/gamescope-session.backup
echo Patch the gamescope-session.

# check the possible combinations and then patch gamescope-session based on the user choice
grep STEAM_DISPLAY_REFRESH_LIMITS=30,60 /bin/gamescope-session
if [ $? -eq 0 ]
then
sed "s/STEAM_DISPLAY_REFRESH_LIMITS=30,60/STEAM_DISPLAY_REFRESH_LIMITS=$Choice/g" /bin/gamescope-session | sudo tee /bin/gamescope-session.patched > /dev/null
fi

grep STEAM_DISPLAY_REFRESH_LIMITS=40,60 /bin/gamescope-session
if [ $? -eq 0 ]
then
sed "s/STEAM_DISPLAY_REFRESH_LIMITS=40,60/STEAM_DISPLAY_REFRESH_LIMITS=$Choice/g" /bin/gamescope-session | sudo tee /bin/gamescope-session.patched > /dev/null
fi

grep STEAM_DISPLAY_REFRESH_LIMITS=30,70 /bin/gamescope-session
if [ $? -eq 0 ]
then
sed "s/STEAM_DISPLAY_REFRESH_LIMITS=30,70/STEAM_DISPLAY_REFRESH_LIMITS=$Choice/g" /bin/gamescope-session | sudo tee /bin/gamescope-session.patched > /dev/null
fi

grep STEAM_DISPLAY_REFRESH_LIMITS=40,70 /bin/gamescope-session
if [ $? -eq 0 ]
then
sed "s/STEAM_DISPLAY_REFRESH_LIMITS=40,70/STEAM_DISPLAY_REFRESH_LIMITS=$Choice/g" /bin/gamescope-session | sudo tee /bin/gamescope-session.patched > /dev/null
fi
# patch gamescope-session based on the user choice
sed "s/STEAM_DISPLAY_REFRESH_LIMITS=..,../STEAM_DISPLAY_REFRESH_LIMITS=$Choice/g" /bin/gamescope-session | sudo tee /bin/gamescope-session.patched > /dev/null

sudo cp /bin/gamescope-session.patched /bin/gamescope-session
sudo steamos-readonly enable
Expand Down Expand Up @@ -119,24 +97,8 @@ if [ \$? -ne 0 ]
then echo gamescope-session needs to be patched back to the default values.
echo Patch the gamescope-session to the default values.
# check the possible combinations and then patch gamescope-session based on the user choice
grep STEAM_DISPLAY_REFRESH_LIMITS=30,60 /bin/gamescope-session
if [ \$? -eq 0 ]
then
sed "s/STEAM_DISPLAY_REFRESH_LIMITS=30,60/STEAM_DISPLAY_REFRESH_LIMITS=40,60/g" /bin/gamescope-session | sudo tee /bin/gamescope-session.patched > /dev/null
fi
grep STEAM_DISPLAY_REFRESH_LIMITS=30,70 /bin/gamescope-session
if [ \$? -eq 0 ]
then
sed "s/STEAM_DISPLAY_REFRESH_LIMITS=30,70/STEAM_DISPLAY_REFRESH_LIMITS=40,60/g" /bin/gamescope-session | sudo tee /bin/gamescope-session.patched > /dev/null
fi
grep STEAM_DISPLAY_REFRESH_LIMITS=40,70 /bin/gamescope-session
if [ \$? -eq 0 ]
then
sed "s/STEAM_DISPLAY_REFRESH_LIMITS=40,70/STEAM_DISPLAY_REFRESH_LIMITS=40,60/g" /bin/gamescope-session | sudo tee /bin/gamescope-session.patched > /dev/null
fi
# patch gamescope-session based on the user choice
sed "s/STEAM_DISPLAY_REFRESH_LIMITS=..,../STEAM_DISPLAY_REFRESH_LIMITS=40,60/g" /bin/gamescope-session | sudo tee /bin/gamescope-session.patched > /dev/null
sudo cp /bin/gamescope-session.patched /bin/gamescope-session
echo gamescope-session is now using the default value 40,60.
Expand Down

0 comments on commit bb1874a

Please sign in to comment.