Skip to content

Instantly share code, notes, and snippets.

@simons-public
Created July 21, 2023 07:12
Show Gist options
  • Save simons-public/8af12ca4be9a6cbe2fd7e70f09a63bc9 to your computer and use it in GitHub Desktop.
Save simons-public/8af12ca4be9a6cbe2fd7e70f09a63bc9 to your computer and use it in GitHub Desktop.
Conan Exiles FreeBSD rc script
#!/bin/sh
#
# PROVIDE: conan
# REQUIRE: networking
# KEYWORD:
. /etc/rc.subr
name="conan"
load_rc_config ${name}
: ${conan_user:="conan"}
: ${conan_enable:="no"}
: ${conan_winedir:="/conan/wine"}
: ${conan_display:="0"}
: ${conan_winedebug:="-all,+err,warn-file"}
: ${conan_logfile:="/var/log/conan.log"}
: ${conan_pidfile:="/var/run/conan.pid"}
export WINEARCH=win64
export WINEDEBUG=${conan_winedebug}
export WINEPREFIX=${conan_winedir}
export DISPLAY=:${conan_display}
rcvar="conan_enable"
conan_user=${conan_user}
extra_commands="update backup"
update_cmd="conan_update"
backup_cmd="conan_backup"
start_precmd="conan_prestart"
stop_postcmd="conan_poststop"
command="/usr/sbin/daemon"
pidfile=${conan_pidfile}
exe_path='/conan/Conan\ Exiles\ Dedicated\ Server/ConanSandboxServer.exe'
command_args="-o ${conan_logfile} -P ${conan_pidfile} /usr/local/bin/wine64 ${exe_path}"
conan_prestart() {
if ! test -f /tmp/.X0-lock ; then
echo No Xvfb framebuffer running, starting Xfvb
su ${conan_user} -c "/usr/local/bin/Xvfb -screen ${conan_display} 640x480x24:32 &"
else
echo Xvfb framebuffer already running
fi
touch ${conan_logfile} ${conan_pidfile}
chown ${conan_user} ${conan_logfile} ${conan_pidfile}
}
conan_poststop() {
xvfb_pid=$(check_pidfile /tmp/.X0-lock /usr/local/bin/Xvfb)
kill -TERM $xvfb_pid
su ${conan_user} -c "/usr/local/bin/wineserver -k"
}
conan_update() {
service conan stop
scp -r deck@steamdeck:/home/deck/.local/share/Steam/steamapps/common/Conan\\\ Exiles\\\ Dedicated\\\ Server /conan
}
conan_backup() {
cd /conan
tar -czvf config-backup-$(date +%d%m%Y).tar.gz 'Conan Exiles Dedicated Server/ConanSandbox/Saved/'
}
conan_install() {
pkg install wine winbind winetricks samba416 xorg-xfbserver
}
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment