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

[bugfix-627] build BSM with deb and flatpak for linux #629

Merged
merged 19 commits into from
Nov 30, 2024

Conversation

silentrald
Copy link
Collaborator

@silentrald silentrald commented Oct 25, 2024

Closes #627, Closes #468

  • Add docs for installing the different BSM builds

NOTES

@silentrald silentrald marked this pull request as ready for review October 25, 2024 11:51
@Zagrios
Copy link
Owner

Zagrios commented Oct 27, 2024

I will review the #586 tomorow to merge it before this one
When this one is merge I will probably release a alpha.5

@Zagrios
Copy link
Owner

Zagrios commented Oct 29, 2024

@silentrald is it relevant to add more than the .deb ? From what I see here Steam is only available throught a .deb as well 🤔
https://github.com/ValveSoftware/steam-for-linux

@silentrald
Copy link
Collaborator Author

silentrald commented Oct 30, 2024

@Zagrios I think some deb installers are supported but not recommended for all distros.

In Arch Linux's case, we have a different package manager pacman which is different with apt so the problem here is that if we install deb then either we have missing/incompatible dependencies (issue-comment) or manage 2 package manager (pacman and apt) which is not ideal.

https://wiki.archlinux.org/title/Creating_packages_for_other_distributions#Tips_and_Tricks_about_Debian

I think same is true with Fedora that it would prefer to install rpm rather than deb because that is native to their distro as well. Although I don't have a wiki/article to link but there are many sentiments/opinions by Fedora users when you try searching on the net.

So building it with different targets would be best, compatibility wise. The only question now is that, is there any drawback that you probably see into building it into different targets? Except for the build time at least.

Comment on lines 34 to 36
## Wine Install [Optional]

[Wine](https://www.winehq.org/) is a tool to run windows application under Linux. BSManager uses to run [BSIPA](https://nike4613.github.io/BeatSaber-IPA-Reloaded/) so that you can play Beat Saber with mods. You can install `wine` depending on your package manager. If you don't install it, this will just fallback to using the `wine` executable found in your _Proton Folder_.
Copy link
Contributor

@Insprill Insprill Nov 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this section still required now that 586 gets wine from the Proton install?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, just forgot to update, should be in commit 38335f1

@silentrald silentrald force-pushed the bugfix/627 branch 2 times, most recently from 38335f1 to f5a7fcc Compare November 2, 2024 17:48
@Zagrios
Copy link
Owner

Zagrios commented Nov 7, 2024

@silentrald is this PR ready ?
What about the flatpak thing ?

@silentrald
Copy link
Collaborator Author

@Zagrios might get a commit flatpak by today. Since it's universal, do you think we need to drop support on any installer or leave them as is so users can still have a decision of what to install?

@Zagrios
Copy link
Owner

Zagrios commented Nov 8, 2024

@silentrald I think we might keep at least the .deb and maybe the .rpm just in case 👌
Take your time, I won’t be very available this weekend to review any PRs anyway 😉

@silentrald
Copy link
Collaborator Author

@Insprill can I get you opinion as well, since the AUR build would benefit with pacman installer.

What I'm thinking right now is to just ship it with deb and flatpak then for Arch users, we can just let them use the AUR package. If you still need the pacman build, I think you could update the PKGBUILD to something like this, then install the resulting pacman installer.

build() {
  cd "${pkgname%-git}"

  npm run build
  npx electron-builder --publish never --linux pacman --x64
}

This should also automate all the protocol for deep linking so that you don't have to manually create it. Just check if one-click and launch shortcuts work perfectly with the AUR build.

@Insprill
Copy link
Contributor

Insprill commented Nov 8, 2024

I'd be fine dropping the pacman package. Afaik we can't really customize it that much, and anyone on Arch is going to use the AUR anyway. The AUR package(s) will either be built from source where this doesn't matter at all or we can simply extract the .deb.

@silentrald silentrald changed the title [bugfix-627] build BSM with deb, rpm, and pacman [bugfix-627] build BSM with deb and flatpak for linux Nov 9, 2024
@silentrald
Copy link
Collaborator Author

Added flatpak and dropped rpm and pacman.

I've already tested the github action build release and it should be working, you can verify this from my fork https://github.com/silentrald/bs-manager/actions/runs/11752857569


@Zagrios Also as a side tangent as well, if its ok for both me and @Insprill to be added in the README.md file for the credits with the linux contribution?

You are required to have `flatpak` installed your system. After installing that, download the `.flatpak` file in the releases and run the following command:

```bash
flatpak install ./bsmanager.flatpak
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential change to avoid permission issues:
flatpak install --user ./bsmanager.flatpak


### Universal (flatpak)

You are required to have `flatpak` installed your system. After installing that, download the `.flatpak` file in the releases and run the following command:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General idiot-proofing the instructions:

You are required to have flatpak installed your system, if it is not installed then do so using your system's package manager ("sudo apt install flatpak" for Ubuntu, or "sudo pacman -S flatpak" for Arch). After installing, download the .flatpak file from the releases, CD to the download location, and run the following command:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there really a case where someone wants to use the flatpak instead of the AUR package / deb, and they don't have it installed, and don't know how to install it? I could be wrong here, but it seems redundant to me.

Copy link
Collaborator Author

@silentrald silentrald Nov 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think other distro's should be listed in the here like Fedora and NixOS which isn't Debian or AUR supported flatpak website https://flatpak.org/setup/ which should guide any installation. This should also avoid confusion with the main installers that are supported.

@Lohkdesgds
Copy link

Lohkdesgds commented Nov 16, 2024

Man I may be crazy but I am testing that deb app there just for fun
I won't be reviewing even though I want this so bad. Someone that knows more about this code can do that I think :P

Thank you for making it work on linux ❤️

Edit: I tried adding mods to 1.38, the download itself of the version worked, but downloading the mods doesn´t. Hmm

@Zagrios
Copy link
Owner

Zagrios commented Nov 17, 2024

Added flatpak and dropped rpm and pacman.

I've already tested the github action build release and it should be working, you can verify this from my fork https://github.com/silentrald/bs-manager/actions/runs/11752857569

@Zagrios Also as a side tangent as well, if its ok for both me and @Insprill to be added in the README.md file for the credits with the linux contribution?

Of course 👌 Add your names to the Readme in this PR 😉

@silentrald
Copy link
Collaborator Author

silentrald commented Nov 17, 2024

Of course 👌 Add your names to the Readme in this PR 😉

@Zagrios Thank you, will create in the next commit.

Although I'm still having problems with the flatpak build though, I confirmed with @LiamillionSS that you can run the flatpak of BSM but you can't run any BS version because of some flatpak sandboxing rules. I'm still investigating/researching it, though I'm worrying if I can push it to the v1.5.0 release. If I can't meet the release deadline, I might commit a push to temporarily support AppImage for now as the universal linux release and I can support with the deep linking configuration. What do you think?

Update:
Already got a working solution, might get the commit by tomorrow (my timezone), and will get it tested by others as well.

@Zagrios
Copy link
Owner

Zagrios commented Nov 18, 2024

@silentrald I saw your update message. But yeah if we can't have proper a working solution with Flatpak, we can first release only the .deb and .rpm files, and then release a .flatpak later 👌

@Zagrios
Copy link
Owner

Zagrios commented Nov 18, 2024

@silentrald I've pushed a small change to be able to package and publish on Windows.

But I've downloaded the build artifact from your repo action, and I get this error when I try to open BSM after installing the Flatpak: Failed to sync with dbus proxy

I couldn't launch the .deb either, but I believe that's because I already have a BSM instance installed from a .deb 🤔

@silentrald
Copy link
Collaborator Author

@Zagrios

But I've downloaded the build artifact from your repo action, and I get this error when I try to open BSM after installing the Flatpak: Failed to sync with dbus proxy

What was your installation process/steps? Did you follow the installation guide in the Linux.md file in this commit as well?

I couldn't launch the .deb either, but I believe that's because I already have a BSM instance installed from a .deb 🤔

You could do a

sudo dpkg --remove bs-manager

but the dpkg install should automatically overwrite the files on dpkg install afaik 🤔. Or there are conflicting files within your system that isn't deb, you might need to manually delete/remove the files in most of the /opt/BSManager directory in any case.

@Zagrios
Copy link
Owner

Zagrios commented Nov 19, 2024

@silentrald
Okay, the .flatpak is working; it's just that right after the installation, I still get the error. However, starting BSManager from the explorer works 🤷

2024-11-19.20-21-22.mp4

For the .deb, it didn’t work directly. I need to start BSM directly from the /opt/BSManager directory or through the terminal with the --no-sandbox argument.
Otherwise, I get this error:

The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /opt/BSManager/chrome-sandbox is owned by root and has mode 4755.
Trace/breakpoint trap (core dumped)
2024-11-19.20-40-15.mp4

silentrald and others added 11 commits November 22, 2024 00:57
- updated flatpak installation
- moved deb and AUR above flatpak so users with appropriate distros will install those first
- idiot-proofing on how to install flatpak on different distros
moved all launching logic to the LinuxService
handled issue with write only directory with bs-versions.json
* created wrapper calls for spawn and exec for all os support
* refactored names for isProcessRunning, getProcessId, and isSteamRunning
@silentrald
Copy link
Collaborator Author

@Zagrios got every actions on the green. Everything should work as expected now, please retest the mods installation and game launching for both linux and windows. Build versions (nsis, deb and flatpak) needs to be verified as well ig. So that if there are any issues encountered, I can fix them immediately.

@Zagrios
Copy link
Owner

Zagrios commented Nov 22, 2024

@silentrald

Issues with flatpak:

  • When enabling oneclicks, they stay disabled
  • Cannot install maps to original Steam version (because of sandbox i guess ?) (same with models and mods):
[error] Error: ENOENT: no such file or directory, mkdir '/home/mathieu/.local/share/Steam/steamapps/common/Beat Saber/Beat Saber_Data/CustomLevels/41d68 (unending thoughts of everyone and everything - member63432_19, member63432_63, member63432_-210^3)' ENOENT undefined
  • Can't launch BS version >= 1.39.1 (version below that works) (Same as the deb below)

With the deb:

  • BSM ask for my keychain for some reason ?
  • Can't launch BS version >= 1.39.1 (version below that works):
    image
  • Installing BSIPA produce tons of errors, but it does install 😅 (this is just a sample) :
[2024-11-22 21:08:46.173] [error] IPA process stderr 0024:err:mscoree:LoadLibraryShim error reading registry key for installroot

[2024-11-22 21:08:46.177] [error] IPA process stderr 0024:err:mscoree:LoadLibraryShim error reading registry key for installroot

[2024-11-22 21:08:46.219] [error] IPA process stderr 0024:fixme:nls:GetFileMUIPath stub: 0x10, L"C:\\windows\\system32\\tzres.dll", (null), 000000000011E7C0, 0000000000944CE0, 000000000011E7C8, 000000000011E7B8
  • I cannot disable OneClicks (But I believe that's exptected ? 🤔)

@silentrald
Copy link
Collaborator Author

@Zagrios

  • For the OneClick settings, the electron js code doesn't work with Linux. Also created an [BUG] : OneClick settings does not work in Linux #651 issue to delay the fix since I have to check if the fix is possible.

  • For the flatpak install, yeah this needs to have create/rw permission to the Beat Saber folder so just needs to add this

~/.steam/steam/steamapps/common/Beat Saber:create
  • I could run 1.39.1 version for both deb and flatpak 🤔. Can you reinstall this in any case it's just that specific version you we're testing was corrupted/broken?

  • BSIPA installs with wine throw a lot or unnecessary stderr but as long as the install works, it shouldn't be a problem. It's just good to have logs if any errors would pop out in users BSIPA installations.

  • The keyring, this one I'm not too keen what really it is. But it has something to do with logging in, if you skip the ubuntu login page. Although I have to check if this is a system thing or just the application itself asking to get unecrypted (even if I don't add a password it still runs fine 🙃)

@silentrald
Copy link
Collaborator Author

@Zagrios The keyring seems to be a system thing with the user either needs to login or disable it from their machine. Ive also checked on electron-builder configs, seems theres nothing there and also in apt/dpkg docs doesn't seem to have anything relating to this. So probably safe to ignore this.

@Zagrios
Copy link
Owner

Zagrios commented Nov 25, 2024

@silentrald Okay, that's fine for me 👌
Could you trigger a build action on your repo? I'll test it one last time

@silentrald
Copy link
Collaborator Author

silentrald commented Nov 26, 2024

@Zagrios got it. Release Linux should be this one https://github.com/silentrald/bs-manager/actions/runs/12021117904

@Zagrios
Copy link
Owner

Zagrios commented Nov 28, 2024

@silentrald

Flatpak

  • Now i can install things to my original copy of Beat Saber 👌
  • Now i can't launch any copy of Beat Saber 😅 (I've tried to reboot but nothing change)
[2024-11-28 20:57:52.014] [info]  Linux exec command
> flatpak-spawn --host  ps awwxo args | grep -c "steam-runtime-launcher-service"
[2024-11-28 20:57:52.034] [error] Error: Command failed: flatpak-spawn --host  ps awwxo args | grep -c "steam-runtime-launcher-service"
Portal call failed: org.freedesktop.DBus.Error.ServiceUnknown

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:519:28)
    at Pipe.<anonymous> (node:net:339:12)
[2024-11-28 20:57:55.964] [error] Unable to open steam
[2024-11-28 20:57:55.965] [info]  Linux spawn command
> flatpak-spawn --host --env=SteamAppId="620980" --env=SteamOverlayGameId="620980" --env=SteamGameId="620980" --env=WINEDLLOVERRIDES="winhttp=n,b" --env=STEAM_COMPAT_DATA_PATH="/home/mathieu/.steam/steam/steamapps/compatdata/620980" --env=STEAM_COMPAT_INSTALL_PATH="/home/mathieu/.local/share/Steam/steamapps/common/Beat Saber" --env=STEAM_COMPAT_CLIENT_INSTALL_PATH="/home/mathieu/.steam/steam" --env=STEAM_COMPAT_APP_ID="620980" --env=SteamEnv="1" "/home/mathieu/.steam/steam/steamapps/common/Proton - Experimental/proton" run "/home/mathieu/.local/share/Steam/steamapps/common/Beat Saber/Beat Saber.exe" fpfc
[2024-11-28 20:57:55.984] [info]  BS process exit with code 1
[2024-11-28 20:57:55.984] [info]  BS process exit code 1

  • BSM has lost its icon 😢 (And it should be BSManager not bs-manager)
    image
  • Cannot downgrade BS versions (same issue as the .deb):
[2024-11-28 21:22:23.169] [error] Error: spawn /app/lib/com.electron.bs_manager/resources/assets/scripts/DepotDownloader ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) ENOENT undefined

Deb:

  • Also lost its icon (rip)
  • Can launch Beat Saber
  • Cannot downgrade BS versions
[2024-11-28 21:13:03.006] [error] Error: spawn /opt/bs-manager/resources/assets/scripts/DepotDownloader ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) ENOENT undefined

image

@silentrald
Copy link
Collaborator Author

silentrald commented Nov 28, 2024

@Zagrios

Now i can't launch any copy of Beat Saber 😅 (I've tried to reboot but nothing change)

This is related to permissions. I've already added that in the default but you could try to reset the permissions using FlatSeal. When you reset it you should see org.freedesktop.Flatpak.

[Checking the DepotDownloader and Icons Issue]

Yeah could replicate this, double checking the what happened to the build if I built the correct branch. forgot to update the build script to use the electron-builder.config.js file 😬. Rebuilding it now.

Should be available in https://github.com/silentrald/bs-manager/actions/runs/12075659299

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots

See analysis details on SonarQube Cloud

@Zagrios
Copy link
Owner

Zagrios commented Nov 30, 2024

@silentrald Great news, everything seems to work! 🎉
Can you confirm that everything is ready to merge? 👀

@silentrald
Copy link
Collaborator Author

silentrald Great news, everything seems to work! 🎉
Can you confirm that everything is ready to merge? 👀

@Zagrios confirmed 👌

@Zagrios
Copy link
Owner

Zagrios commented Nov 30, 2024

Merging 🚀 🚀

@Zagrios Zagrios merged commit 5462c88 into Zagrios:master Nov 30, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] : Deeplinking not working in linux [FEAT.] : Documentation on how to install/use on Linux
5 participants