Skip to content

Instantly share code, notes, and snippets.

@benaryorg
Last active March 4, 2021 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benaryorg/c615dcf8493eb05ccf9961fdb48f7c9a to your computer and use it in GitHub Desktop.
Save benaryorg/c615dcf8493eb05ccf9961fdb48f7c9a to your computer and use it in GitHub Desktop.
Risk of Rain 2 server proton runit service
#!/bin/sh
# Copyright (c) 2021 benaryorg <binary@benary.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
set -e
[ -r conf ] && . ./conf
target_user=${ROR2_USER?}
target_serverdir=${ROR2_SERVERDIR?}
target_wineprefix=${ROR2_WINEPREFIX?}
target_protondir=${ROR2_PROTONDIR?}
target_home="$(getent passwd "${target_user}" | cut -d : -f 6)"
test -e "${target_serverdir?}"
test -e "${target_wineprefix?}"
test -e "${target_protondir?}"
test "${ROR2_MODDIR+x}" != x || test -e "${ROR2_MODDIR}"
test "${ROR2_MODDIR+x}" != x || doorstep_path="Z:$(printf %s "${ROR2_MODDIR?}" | sed -E "s#/#\\\\#g")\\BepInEx\\core\\BepInEx.Preloader.dll"
test "${ROR2_MODDIR+x}" != x && doorstep_bool="false" || doorstep_bool="true"
exec chpst -u "${target_user?}" \
unshare --mount --user --pid --map-current-user --kill-child --mount-proc \
dumb-init \
xvfb-run -a \
env \
"HOME=${target_home?}" "WINEPREFIX=${target_wineprefix?}" "PATH=${target_protondir?}/dist/bin" "WINEDLLOVERRIDES=winhttp=n,b" \
wine \
"${target_serverdir?}/Risk of Rain 2.exe" \
--doorstop-enable "${doorstep_bool?}" ${doorstep_path+--doorstop-target} ${doorstep_path}
@benaryorg
Copy link
Author

I think you'll find most of the information as to the convoluted parts here: https://twitter.com/benaryorg/status/1367012863269830656

Also big shoutout to who made this: https://github.com/avivace/ror2-server/

@benaryorg
Copy link
Author

After some further examination it seems you need to set the HOME variable (and maybe need an entire Steam install there) for the Steamworks discovery to work (read: your server showing up in the server browser).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment