-
Notifications
You must be signed in to change notification settings - Fork 67
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
Steam Deck dependency enhancement #1111
base: master
Are you sure you want to change the base?
Conversation
Woah! Thank you for making this PR!
We can put this on the Global Menu, but indeed, it is tricky to know the best spot for this... Maybe under "Misc" settings? https://github.com/sonic2kk/steamtinkerlaunch/blob/master/steamtinkerlaunch#L5664
From a quick glance at the logic here (https://github.com/sonic2kk/steamtinkerlaunch/pull/1111/files#diff-77c6d4bb1bf7c1988ff5a068c856b6c24e113663f2e61cb3a2c98723c0fafc04R25928) it seems like it would already handle it. The
Then skip the dependency update logic. That should prevent STL constantly trying to update itself.
I think the easiest solution here is to run If I'm missing something here let me know :-)
Yes. The reason it's only in Desktop Mode is because notifiers don't work in a GameScope session.
Yeah, there's going to be a conflict here. SteamTinkerLaunch explicitly does NOT clean up archives because I want the ability to use it entirely offline eventually. So the idea was to allow users to manually place the archives and have them be extracted. But with automatically updating the dependencies, I'm not sure how to serve both needs. The complexity around solving this is very off-putting.
Some consistency around this would be good, but making sure it doesn't interrupt places where spaces are used deliberately is important. Unless we go with using spaces instead of tabs rather than the other way around. I guess it's something I can look into at another time :-) |
f52ca74
to
26b7f9c
Compare
This draft is still UNTESTED. What's new :
Does everything look good to you ? Before jumping on the ship in order to test it, I wanted to know if "theoretically" all the logic is in place. |
I left a couple of comments, but overall this makes sense to me. This is very well implemented from reading and following the code. If might see just how difficult it would be to set up a SteamOS VM to test this, because I'd like to give this the proper testing and review it deserves. I appreciate being able to follow the commits for the new changes too. The only one I left a comment about really was the Overall, freaking excellent job 👍 I think once we resolve the open comments this is good to start testing. I don't really remember what the problems were with a SteamOS VM that others reported but I guess there's only one way to find out the problem and that's to tinker around with it for myself 😄 |
Thank you a lot for all your explanations on the different part of the code. I will start testing on an SteamOS VM very soon. I found this guide which I will use as a base to try the installation ! |
Resolved all the comments, thanks for your explanations. Also thanks for the guide. I wonder if it works without VirtualBox. It doesn't seem like any of the steps here are specific to it (the Guest Additions can probably be replaced with Spice). Most of it seems like general Arch installation steps with a little extra flavour to set the default boot session and such :-) |
I have tested this on my steam deck but so far seems to not be working. I added the yad URL as listed in the master commit as it downloaded a 0B file but I'm still getting the update spam. On the "Main" (bleeding-edge branch) of SteamOS.
|
Co-authored-by: Eamonn Rea <eamonnrea@gmail.com> fix: small typo between 1 and 0
e3bc04f
to
f699a63
Compare
Thank you a lot for your testing. I rebased to have the Yad url fix in this PR. Not sure what went wrong, I will test it on my steam deck tonight too and see how I can prevent notification spam. |
Since we're checking if it's equal to one, perhaps we can simply do this: function updateSteamDeckLastVers {
# This function updates the 'lastvers' file after a dependency update if there was a version change
if checkSteamDeckSTLUpdated ; then
echo "$PROGVERS" > "$STLSTEAMDECKLASTVERS"
fi
} This is how we use, for example, The I'll do a scan of the PR later to see if we need to fix this up in other places. This is my bad for not realising, I'm too used to convenience in other languages 😅 Both in not catching it in this PR and not capturing it when I prototyped this logic before. (I didn't run the workflow again because afaict the last force-push was just a rebase, so I'll run the workflow again when this is marked ready for review.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should've caught this before, very sorry I only realised these now 😓
Give these a try locally and see if they pan out. If so push them up and the update checks should be fine :-)
CHECKLASTVERSSTEAMDECK="$( cat "$STLSTEAMDECKLASTVERS" )" | ||
if [ "$CHECKLASTVERSSTEAMDECK" = "$PROGVERS" ]; then | ||
writelog "INFO" "${FUNCNAME[0]} - Last known SteamTinkerLaunch install version ('$CHECKLASTVERSSTEAMDECK') and the current version ('$PROGVERS') match -- There has been no update since last launch" | ||
return 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return 0 | |
return 1 |
return 0 | ||
else | ||
writelog "INFO" "${FUNCNAME[0]} - Last known SteamTinkerLaunch install version ('$CHECKLASTVERSSTEAMDECK') and the current version ('$PROGVERS') do NOT match -- It seems there has been an update!" | ||
return 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to return 0
because 0
is a success code.
return 1 | |
return 0 |
# 2. The dependency can actually be ran, confirming it is a valid file | ||
# 3. SteamTinkerLaunch has not updated or autoupdater isn't enabled, so there would be no change in dependency version and thus no need to update | ||
# If any of these are false, we need to check our dependencies (if a file is missing we would need to update, or if it cannot be used we need to update, and also if STL updated we may need a newer version, so update). | ||
if [[ -f "$(command -v "$DEPCMD")" && "$CHECKCMD" = "OK" && ( "$( checkSteamDeckSTLUpdated )" -eq 0 || "$STEAMDECK_AUTOUP" -eq 0 ) ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the changes to how checkSteamDeckSTLUpdated
works, it'll return 0
(positive, meaning an update occurred), so we can use it like a true boolean value. Note how it can be used without square brackets, because it's not a test
condition (Bash is weird).
if [[ -f "$(command -v "$DEPCMD")" && "$CHECKCMD" = "OK" && ( "$( checkSteamDeckSTLUpdated )" -eq 0 || "$STEAMDECK_AUTOUP" -eq 0 ) ]]; then | |
if [[ -f "$(command -v "$DEPCMD")" && "$CHECKCMD" = "OK" && ( checkSteamDeckSTLUpdated || "$STEAMDECK_AUTOUP" -eq 0 ) ]]; then |
ShellCheck also shouldn't complain about this, with the code below at least it was happy.
I verified this sort of logic works with a little test script, hopefully it helps illustrate the logic a little better :-)
#!/usr/bin/bash
PROGVERS="1.2.3"
function hasUpdated {
oldvers="1..3"
if [ "${oldvers}" = "${PROGVERS}" ]; then
# no update
return 1
else
return 0
fi
}
boolvar=1 # Set this to 0 to get "no update"
if ( hasUpdated && [ "${boolvar}" -eq 1 ] ); then
echo "Has updated"
else
echo "no update"
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was about to fall asleep and it just dawned on me that this should probably be a ! checkSteamDeckSTLUpdated
check, since before we were checking -eq 0
.
I think there is some weirdness around how Bash treats the !
negation, so please test if you can to make sure the negation doesn't affect the whole statement and only that checkSteamDeckSTLUpdated
check.
I'll try do some testing in a test script tomorrow to see how Bash handles this. I don't know if there's any examples in the codebase of this kind of check in a compound if
check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried this solution and came across an issue, it doesn't look like the return value of a function is supported inside a test [[
. See https://stackoverflow.com/a/42971383
I'm not sure how we should tweak it, one idea could be to "preload" the function response before the answer output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried this solution and came across an issue, it doesn't look like the return value of a function is supported inside a test
That's a bit strange, is the code snippet I provided invalid then? It seemed to work in my testing...
Plus, we use if funcThatReturnsZero ; then
syntax around the codebase already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not invalid, in the current if
it's more like if [[ hasUpdated && ( "${boolvar}" -eq 1 ) ]]
and I don't know how to properly wrap the or
to override the update if they're disabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this work?
if [[ -f "$(command -v "$DEPCMD")" && "$CHECKCMD" = "OK" ]] && ( checkSteamDeckSTLUpdated || [[ "$STEAMDECK_AUTOUP" -eq 0 ]] ); then
# ...
fi
I'm playing around with this in a test script. The logic is a little complex here, but I think this should work, since ( checkSteamDeckSTLUpdated )
should capture the return, and we wrap the check on $STEAMDECK_AUTOUP
in a separate [[
test.
In my tests with the above:
- If
DEPCMD
fails, we will need to update. - If
CHECKCMD
fails even ifDEPCMD
passes, we need to update. - If
checkSteamDeckSTLUpdated
returns1
(meaning no update was found), we will only need to update ifDEPCMD
failsCHECKCMD
fails- Both
DEPCMD
andCHECKCMD
fails - Or if
STEAMDECK_AUTOUP
is1
(meaning we want to always check for updates).
- If
STEAMDECK_AUTOUP
is1
, we will always need to update regardless ofDEPCMD
,CHECKCMD
, andcheckSteamDeckSTLUpdated
I think that logic is correct, but I might be missing something obvious 😅
|
||
function updateSteamDeckLastVers { | ||
# This function updates the 'lastvers' file after a dependency update if there was a version change | ||
if [ "$( checkSteamDeckSTLUpdated )" -eq 1 ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same idea here with how checkSteamDeckSTLUpdated
is used:
if [ "$( checkSteamDeckSTLUpdated )" -eq 1 ]; then | |
if checkSteamDeckSTLUpdated; then |
I just tried your suggestions, we're close to making it work but it looks like we need to make some tweaking ! And I noticed other things: Recap of the remaining issues :
|
Yes, we should update notifier logic I think, but I think all the remaining notifier-related "problems" can be done in a separate PR.
So we can remove two notifiers related to automatic updates once that logic is stripped out. If the notifier logic for installing and finished installing is incorrect, that should be fixed to only show on initial installation (i.e. when the script is executed to install STL initially, or when installed from ProtonUp-Qt which just runs Users that are bothered by the notification spam are probably not users who STL is aimed at, they tend to be the non-developers that bought Steam Decks in my experience. And STL on Steam Deck is mainly an enthusiast/developer curiosity, not something to be used seriously in its current form, hence the wiki's emphasis that SteamTinkerLaunch on SteamOS is in early stages, yet you are one of the few devs who actually stood up to contribute, there aren't many contributors on the desktop side and virtually none for SteamOS, so it's nice to see someone that cares enough to actually improve the situation. So to that end feel free to pick up the notifier work in a future PR, but there is absolutely no obligation on you to do so in this PR (it is probably cleaner in a separate PR anyway).
EDIT: I left a comment about it, we can discuss the
Hmm, something is going wrong in It might be worth checking the |
Thank you for your comments, sadly I won't be able to look and tinker with the code until Monday but will as soon as I'm available! I will also make a separate PR for the steam deck notifications. And I may look into a debug var that enables the steam deck behavior to make it easier to test. I don't need it to run the libs but mainly to test the codes/logic! (I'll probably add a dev check to prevent people wanting the steam deck behavior in desktop mode) |
No worries, you can work on this whenever you have time. All your work is appreciated thus far as well! :-) |
I went ahead and linked this PR to #859, as this is the last thing discussed in that issue related to Steam Deck improvements. You've expressed interest in doing more work, and you are absolutely welcome to contribute any improvements in the future. But as far as that issue goes, this PR would implement all that was left specific to that issue. So once this is merged, that issue would be done, even if there is more work you or anyone else may want to do! Of course that doesn't mean there is any rush on this either. I've just been doing a little "issue cleanup" and this was part of it. You can work on this whenever you have time and motivation. If we hit any major blockers in a worst-case and we can't merge this (which I don't foresee happening, imo this is already most of the way there, once again fantastic work on your part), linking the issues gives a good paper-trail on what went on during development. Development transparency is very important to me with this project and giving everyone insight into what decisions were made, where discussion took place, etc is something I strive for (even if I don't always live up to that in the way I want to). So yeah, please don't feel any additional pressure here. Just some repo management 😄 |
This draft implements the base discussed in #859 (comment).
Here what's implemented in this draft and some hurdles I noticed that we will need to fix before marking it ready.
lastvers
with that of the incoming version (we can get the incoming version fromPROGVERS
) - managed bycheckSteamDeckSTLUpdated
lastvers
is the same as the incoming version, do nothing (this will prevent the constant echo spam on each launch stating that STL needs to be updated)lastvers
does not match the incoming version string, we should try to update our dependencies, as the newer STL version may specify a newer version of a given dependencylastvers
so that we know we already checked for dependency updates for this version. - See in issues, I think we could force the overwrite each time the libs are updatedIssues:
If coming from an already existing install, we will create thelastvers
file ⇒ leading to not update the libs on the first stl update after this PR, maybe we need to create the lastvers after the installation of the libs each time (overwrite thelastvers
or creating it for the first time, either way it's a simple bash pipe), and makecheckSteamDeckSTLUpdated
return 0 if the file doesn't exist either.Note: Also while editing I saw that sometimes there are 4 spaces while in the script it's mainly tabs. Should we make some reformat to fix this later on ?
Note 2: This is currently untested