FritzAndFriends / StreamDeckToolkit

A .NET Standard library, template, and tools for building extensions to the Elgato Stream Deck
MIT License
164 stars 45 forks source link

Non-Windows environments should try to run the PowerShell script #96

Open hugodahl opened 5 years ago

hugodahl commented 5 years ago

Is your feature request related to a problem? Please describe. To help reduce duplication of effort, when launching the post-build event on non-Windows environments, we should check to see if PowerShell Core is installed. If it is, we should call pwsh with the RegisterPluginAndStartStreamDeck.ps1 as it will likely have the most current and up-to-date changes before the shell script (RegisterPluginAndStartStreamDeck.sh) will

Describe the solution you'd like From the RegisterPluginAndStartStreamDeck.sh script, check for the presence of PowerShell Core. There are myriad ways of doing this, but we should strive to make sure that the method used is compatible with a base Bash shell, that is, /bin/sh.

Describe alternatives you've considered Within the community, we've tried to keep parity between the PowerShell and Shell scripts, however, there is a lot more experience and comfort writing PowerShell than Shell scripts.

Additional context None

Is there one or more bugs reported related to this suggestion? If so, mention them below none

NotMyself commented 5 years ago

I am not sure this is the right path to take. On windows, you can be fairly certain that powershell is available. On, not windows you can be fairly certain that bash is available. There is a tiny number of powershell core installs by comparison.

So, we would be writing logic that we have to maintain forever, to support a small number of people who happen to have powershell on non-windows OSes. Given our audience, that might be a larger number than the average, but I still think it is minimal value for the effort.

just my 💵💵 <-- closest thing to $0.02 I could find.

hugodahl commented 5 years ago

I am not sure this is the right path to take. On windows, you can be fairly certain that powershell is available. On, not windows you can be fairly certain that bash is available. There is a tiny number of powershell core installs by comparison.

So, we would be writing logic that we have to maintain forever, to support a small number of people who happen to have powershell on non-windows OSes. Given our audience, that might be a larger number than the average, but I still think it is minimal value for the effort.

just my 💵💵 <-- closest thing to $0.02 I could find.

That's a good point. I was thinking of something incredibly basic. Either calling pwsh -c "exit 0;" (or close to it) and make sure we get a 0 return code. I've also come across built-in shell commands, like command <file> or hash <file> to see if a file or application is in your $PATH environment variable.

If it is, call PowerShell with the .ps1 file and return its exit code, otherwise, run the rest of the script as it is today.

NotMyself commented 5 years ago

What about environment specific things like the elgato plugin install location?

hugodahl commented 5 years ago

What about environment specific things like the Elgato plugin install location?

In the stream on Thursday Feb 7th, 2019 (linking for posterity and SEO-fu), there was work done with Tyler, which isn't merged yet, that added considerations for scenarios specific to the environment and platform.