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

Use sed wildcards instead of grepping for common values #3

Merged
merged 1 commit into from
Mar 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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