scripts icon indicating copy to clipboard operation
scripts copied to clipboard

SteamScript: make sure Steam is closed after installation

Open plata opened this issue 8 years ago • 9 comments

Currently, it is possible that a user runs Steam after it is installed. However, the SteamScript will not continue before Steam is closed.

Find a way to ensure that Steam is closed. If that's not possible, change the setup wizard to show a hint.

plata avatar Jan 01 '17 21:01 plata

Would wine.kill() do the trick?

qparis avatar Jan 02 '17 00:01 qparis

The problem is not to close Steam. That's easily possible with:

wine.runInsidePrefix(wine.getProgramFiles() + "/Steam/Steam.exe", "-shutdown");

But you have to know when you can do that (i.e. when the installation is finished). As it is right now, wine.wait() does not return after Steam has been installed but only after Steam has been closed after the installation.

plata avatar Jan 02 '17 12:01 plata

Then you could easily check the manifest file

qparis avatar Jan 02 '17 12:01 qparis

Just to clarify: this issue is not about the installation of a game via Steam (this works already). It is about the installation of Steam itself.

plata avatar Jan 02 '17 12:01 plata

The steamapps folder is created at first startup (after the Steam update). So this could be checked. But we then we need to figure out if the setup has finished already. The core problem is that the process builder looks at the wine process and not at the SteamSetup process. Therefore, the Steam process is blocking the waitFor().

plata avatar Jan 02 '17 13:01 plata

I have an idea: wine script:

that.isRunning = function () {
    if(that._process) {
        try {
            that._process.exitValue();
            return false;
        } catch (err) {
            return true;
        }
    }
    return false;
};

SteamScript:

while (wine.isRunning())
{
    java.lang.Thread.sleep(1000);
    if (fileExists(wine.prefixDirectory + "/drive_c/" + wine.getProgramFiles() + "/Steam/steamapps")) {
        wine.runInsidePrefix(wine.getProgramFiles() + "/Steam/Steam.exe", "-shutdown");
    }
}

But the isRunning() does not work. It immediately returns 0.

plata avatar Jan 02 '17 15:01 plata

Hum, we need to implement a real process manager bean in java that takes this need into account.

Basically you need an event triggered when the process is stopped. This can be done without active waiting

qparis avatar Jan 02 '17 18:01 qparis

Yes. But I think that can be delayed.

For now, we should get the required verbs finished so that people can start rewriting their scripts. If the scripts are done, PoL 5 is already pretty much usable.

plata avatar Jan 02 '17 20:01 plata

Agreed on that

qparis avatar Jan 02 '17 20:01 qparis