JustArchiNET / ArchiSteamFarm

C# application with primary purpose of farming Steam cards from multiple accounts simultaneously.
Apache License 2.0
11.16k stars 1.05k forks source link

FreeBSD (unofficial) Support? #2129

Closed Thefrank closed 3 years ago

Thefrank commented 3 years ago

Feature request

Purpose

Preamble: Microsoft does not currently produce an official package for dotNET5 hence the asking for unofficial support here.

ASF currently does not support FreeBSD as a valid target in scripts. Adding it would allow those that wish to run ASF on FreeBSD (or FreeBSD based jails) to use it.

Solution

This diff should work (I can make a pull request if desired)

diff --git a/cc.sh b/cc.sh
index 6324bbba..bcea1024 100755
--- a/cc.sh
+++ b/cc.sh
@@ -65,6 +65,7 @@ os_type="$(uname -s)"

 case "$os_type" in
        "Darwin") os_type="osx" ;;
+       "FreeBSD") os_type="freebsd" ;;
        "Linux") os_type="linux" ;;
        *) echo "ERROR: Unknown OS type: ${os_type}. If you believe that our script should work on your machine, please let us know."; exit 1
 esac
@@ -74,6 +75,7 @@ cpu_architecture="$(uname -m)"
 case "$cpu_architecture" in
        "aarch64") cpu_architecture="arm64" ;;
        "armv7l") cpu_architecture="arm" ;;
+       "amd64") cpu_architecture="x64" ;;
        "x86_64") cpu_architecture="x64" ;;
        *) echo "ERROR: Unknown CPU architecture: ${cpu_architecture}. If you believe that our script should work on your machine, please let us know."; exit 1
 esac

What is changes: it adds support for FreeBSD as a valid return from uname -a it also adds support for amd64 as being a valid return for uname -m and converts it to x64

Why currently available solutions are not sufficient?

I suppose the current solution of dotnet publish ArchiSteamFarm -c "Release" -f "net5.0" -o "out/generic" as shown in the wiki sufficient. This just adds support for those that would rather use the cc.sh script instead of a couple lines of dotnet commands

Does your suggestion fall into ASF scope?

This request should allow people to idle steam cards from a jail or term window on FreeBSD

Is your suggestion abiding to Steam guidelines?

From my understanding of both guidelines and agreement then yes, this should.

Additional info

As noted above, Microsoft does not produce an official dotNET5 FreeBSD package. The request only touches the cc.sh script as modifications anywhere else might cause failures in CI/CD due to lack of either FreeBSD build environments or inability for things like dotnet-install script to download an official package for dotNET5. I have only tested the idling function and not the asf-ui (asf-ui did build).

root@building:~/ArchiSteamFarm # ./run.sh
.NET SDK (reflecting any global.json):
 Version:   5.0.102
 Commit:    5a80a7968d

Runtime Environment:
 OS Name:     FreeBSD
 OS Version:  12
 OS Platform: FreeBSD
 RID:         freebsd.12-x64
 Base Path:   /root/.dotnet/sdk/5.0.102/

Host (useful for support):
  Version: 5.0.1
  Commit:  2ee13ec8e5

.NET SDKs installed:
  3.1.111 [/root/.dotnet/sdk]
  5.0.102 [/root/.dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.11 [/root/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.1 [/root/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.10 [/root/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.1 [/root/.dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
2021-01-13 15:45:13|dotnet-5578|INFO|ASF|InitCore() ArchiSteamFarm-custom V5.0.3.0 (source/63938f60-7dd9-4218-829e-a3920efbbd0f | FreeBSD 12.2-RELEASE-p2 FreeBSD 12.2-RELEASE-p2 663e6b09467(HEAD) TRUENAS)
2021-01-13 15:45:14|dotnet-5578|WARN|ASF|StartInteractiveConsole() Interactive console is not available due to missing SteamOwnerID config property.
2021-01-13 15:45:14|dotnet-5578|INFO|ASF|RegisterBots() Initializing SteamDirectory...
2021-01-13 15:45:15|dotnet-5578|INFO|ASF|RegisterBots() Success!
2021-01-13 15:45:16|dotnet-5578|INFO|NyanBot|Start() Starting...
2021-01-13 15:45:16|dotnet-5578|INFO|NyanBot|Connect() Connecting...
2021-01-13 15:45:16|dotnet-5578|INFO|NyanBot|OnConnected() Connected to Steam!
2021-01-13 15:45:16|dotnet-5578|INFO|NyanBot|OnConnected() Logging in...

<NyanBot> Please enter your 2FA code from your Steam authenticator app: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2021-01-13 15:45:31|dotnet-5578|INFO|NyanBot|OnDisconnected() Disconnected from Steam!
2021-01-13 15:45:31|dotnet-5578|INFO|NyanBot|OnDisconnected() Reconnecting...
2021-01-13 15:45:31|dotnet-5578|INFO|NyanBot|Connect() Connecting...
2021-01-13 15:45:31|dotnet-5578|INFO|NyanBot|OnConnected() Connected to Steam!
2021-01-13 15:45:31|dotnet-5578|INFO|NyanBot|OnConnected() Logging in...
2021-01-13 15:45:31|dotnet-5578|INFO|NyanBot|OnLoggedOn() Successfully logged on as xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
2021-01-13 15:45:31|dotnet-5578|INFO|NyanBot|Init() Logging in to ISteamUserAuth...
2021-01-13 15:45:32|dotnet-5578|INFO|NyanBot|Init() Success!
2021-01-13 15:45:35|dotnet-5578|INFO|NyanBot|IsAnythingToFarm() Checking first badge page...
2021-01-13 15:45:36|dotnet-5578|INFO|NyanBot|IsAnythingToFarm() Checking other badge pages...
2021-01-13 15:45:38|dotnet-5578|INFO|NyanBot|Farm() We have a total of 10 games (52 cards) left to idle (~1 day, 5 hours remaining)...
2021-01-13 15:45:38|dotnet-5578|INFO|NyanBot|Farm() Chosen idling algorithm: Complex
2021-01-13 15:45:39|dotnet-5578|INFO|NyanBot|FarmSolo() Now idling: 938380 (Townsmen - A Kingdom Rebuilt)
2021-01-13 15:45:39|dotnet-5578|INFO|NyanBot|ShouldFarm() Idling status for 938380 (Townsmen - A Kingdom Rebuilt): 3 cards remaining
2021-01-13 15:45:39|dotnet-5578|INFO|NyanBot|FarmCards() Still idling: 938380 (Townsmen - A Kingdom Rebuilt)
JustArchi commented 3 years ago

This sounds reasonable to me. ./cc.sh script is responsible for generating a build targetting the host machine (that you're building with), which isn't exactly what ASF's generic package is, as generic package includes also parts required for other platforms, as we don't know where exactly that package will be needed.

I'm unsure whether ASF's generic build will run on your unofficial FreeBSD port, as it most likely misses those parts and will crash as soon as it gets to them. However, self-compiled ASF targetting FreeBSD compiled through cc.sh script with unofficial FreeBSD port of .NET SDK should generate those bits, allowing you to enjoy as stable and reliable ASF, as the port is itself.

Therefore of course I'll be happy to include your diff, as the only way to get to this point is having that unofficial port to begin with. If by any chance .NET team adds official support, you can also expect official ASF-freebsd-x64.zip build, but that will only happen with official support, as supporting it unofficially would be too much burden for now.

In any case I'm happy to accept your suggestion and also to find out that you've successfully managed to run ASF on the unofficial port - that gives me hope that FreeBSD might be included soon enough as official build, if a bit more work is put by the people interested in supporting it.

JustArchi commented 3 years ago

Side note: I've noticed that freebsd-x64 is included in the official runtime.json list, and imports #unix, which means that official ASF's generic build should work with unofficial FreeBSD port as well. This means that you don't necessarily have to compile the ASF itself, you can just run the generic build as described on the wiki. Of course there is nothing wrong in compiling ASF either, but it shouldn't be necessary 🙂.