Question about packaging games

Hey there I am currently facing an issue by packaging a game for OBS and to follow the guidelines described here at the same time.

My major issue is that writing my wrapper and creating symlink and only copy files if necessary still leads me to the following issue.
When ever the game is ran from with in the user home directory using:

cd ~/.local/share/opentesarena
exec /usr/bin/openteasarena-client "$@"

it still tries to access data files relative to the real location of the client binary which is in /usr/bin.
However by following the pacakging guidelines data files are not relative to the binary.
Instead those are located either at /usr/share/opentesarena-data/ or as symlinks (except of the game options which needs to be changeable)
in the users home directory at ~/.local/share/opentesarena

Here is the error output btw:

[Game/Game.cpp(35)] Initializing (Platform: Linux).
[Game/Options.cpp(611)] Reading defaults "/usr/bin/options/options-default.txt".
[utilities/KeyValueFile.cpp(149)] Error: Could not find "/usr/bin/options/options-default.txt".
[Game/Options.cpp(85)] Error: Couldn't load "/usr/bin/options/options-default.txt".

The only solution I see to fix this is to copy the entire executable to the home directory as well and then running the binary from within the user directory.
But this is not only considered bad practice it also causes issues when updates the binary in /usr/bin which would then not affect the copy in the home directory
unless it will be overwritten at any launch of the game.

Another solution would be to create a subdirectory in /usr/bin/ called opentesarena and putting the binary plus symlinks to the data files inthere.
However this would cause the game being unable to change the game options since there will be no write permissions unless the game is ran as root
plus the user will not be able to place the game data files of the original game to data/ARENA as the game expects the game files to be located there.

My question is how do I go about this?

The copy everything to the users home folder wrapper was already rejected as being evil which I can understand I don’t like it either so I’m here and asking for a better solution :smiley:

You can find the current WIP wrapper here.

Thank you in advance and I wish you a nice day :slight_smile:

Look at the code and make it look elsewhere, eg Game/Options.cpp(611), look at ownership eg user games.

Look at some of the other packages in the games repo for ideas if writing a wrapper, don’t forget to add file/directory checks so it skips if already created.

Maybe do some foo like I did with njam…

Thank you for your fast reply :smiley:

Well as I was investigating the issue I noticed I just made a huge mistake by not reading the documentation of the game correctly.

Turned out that the game is Linux compatible and uses ~/.config/OpenTESArena/ to store changes to the default options. This is where you then can define a different path for the game to search data files…
My bad (/.-)

But with out your ideas I probably would not have started looking deeper into the code of the engine ^^"

Thank you so much for helping out!

Alright, me again :smiley:

So while removing the wrapper entirely and instead telling the game in the settings file at ~/.config/OpenTESArena/options/optiongs-changes.txt I encountered still the issue above but less critical.

While the engine still tries to load the file options/options-default.txt relative to it’s binary location and also tries to access the files in data/ relative to it’s binary location it is now,
thanks to the options-changes.txt, possible to at least configure the engine to search for the game data files and save games elsewhere.

It would now be possible to create the following file structure:

/usr/bin/OpenTESArena/options/ -> /usr/share/OpenTESArena/options/
/usr/bin/OpenTESArena/data/ -> /usr/share/OpenTESArena/data/

So the binary would move into a sub directory inside /usr/bin with symlinks to the data files at /usr/share/OpenTESArena/
While still allowing the user to place the game data in their home directory and also allow the game to modify it’s settings.

Would this be a valid solution?

I guess I solved this by myself :smiley:
The RPM lint output was so kind to let me know that this is not allowed and such a thing should rather be done in /usr/lib or /usr/lib64 which is what I’ve done now.

/usr/bin/TESArena is now a symlink to %_libdir/OpenTESArena/TESArena


%_libdir/OpenTESArena/options -> %{datadir}/OpenTESArena/options/
%_libdir/OpenTESArena/data -> %{datadir}/OpenTESArena/data/

While the data files stayed in %{datadir}/OpenTESArena/

I think this should conform with the packaging guidelines as like firefox, thunderbird and a few others do this the same way :smiley: