You are not logged in.

#1 2011-10-10 20:12:18

JHeaton
Member
From: United Kingdom
Registered: 2009-05-16
Posts: 158

Some PKGBUILD advice

Hi all. I'm currently trying to write a PKGBUILD for a game and I've come across a small 'problem'. Installing this without making any changes results in the game being installed under /usr/games; the game itself is installed to /usr/games/gamename, inside which is the binary for the game and directories containing the images and sounds used. It also places a script in /usr/games/bin which launches the game. The issue here is, of course, that /usr/games isn't included in the PATH by default as far as I can tell. So my question is, what would be the best way of dealing with this?

Would it be okay to just copy the launch script to /usr/bin. Seems the simplest, but (here's where my Linux knowledge is shown to be weak in areas) I'm not sure whether that's 'right'. Can you just drop launch scripts in there or should it only be used for the compiled binaries themselves?

Any advice or alternative suggestions are appreciated. smile

Offline

#2 2011-10-10 20:33:27

tomd123
Developer
Registered: 2008-08-12
Posts: 565

Re: Some PKGBUILD advice

If everything is under one directory structure that doesn't really follow the fhs, then I would put it into /opt

Then create a simple launch script or modify the existing one.
The script can be as simple as:

#!/bin/sh
cd /opt/gamename
./gamename

I hope this helps!

Offline

#3 2011-10-10 20:42:41

JHeaton
Member
From: United Kingdom
Registered: 2009-05-16
Posts: 158

Re: Some PKGBUILD advice

Thank you for the prompt response! Am I right in assuming it would then be okay for that script to then go in to /usr/bin? I know the questions are really basic, but I want to make sure I'm creating good PKGBUILDs (I'm currently reviewing all of my others to make sure that they follow the guidelines). smile

Offline

#4 2011-10-10 20:45:18

tomd123
Developer
Registered: 2008-08-12
Posts: 565

Re: Some PKGBUILD advice

JHeaton wrote:

Thank you for the prompt response! Am I right in assuming it would then be okay for that script to then go in to /usr/bin? I know the questions are really basic, but I want to make sure I'm creating good PKGBUILDs (I'm currently reviewing all of my others to make sure that they follow the guidelines). smile

Yes, the launcher script that I mentioned should go into /usr/bin

Offline

#5 2011-10-10 21:35:59

JHeaton
Member
From: United Kingdom
Registered: 2009-05-16
Posts: 158

Re: Some PKGBUILD advice

Thank you very much for your help, I really appreciate it. smile

Offline

#6 2011-10-11 05:39:13

MrCode
Member
Registered: 2010-02-06
Posts: 373

Re: Some PKGBUILD advice

Forgive me if this seems dumb, but another idea might be to stick a symlink in /usr/bin that just points directly to the game script in /usr/games/bin.

…just my 2¢. hmm

Offline

#7 2011-10-13 04:16:06

tomd123
Developer
Registered: 2008-08-12
Posts: 565

Re: Some PKGBUILD advice

MrCode wrote:

Forgive me if this seems dumb, but another idea might be to stick a symlink in /usr/bin that just points directly to the game script in /usr/games/bin.

…just my 2¢. hmm

My method is pretty much foolproof since a lot of games like to hardcode paths.. so they would try to open up ./data/ but since the symlink doesn't open the game in its directory, there could be a problem there.
This is why I explicitly cd gamedir first before running the game.

But if you know that a symlink will work, then I agree, a symlink is probably the better/cleaner solution smile

Cheers!

Offline

#8 2011-10-13 07:06:07

JHeaton
Member
From: United Kingdom
Registered: 2009-05-16
Posts: 158

Re: Some PKGBUILD advice

Hmm. I went with Tom's suggestion to use /opt, but the symlink could also work, since the script itself changes directory to the location of the game's executable anyway. I might have a play around with that idea when I get home and see if it does. I suppose one of my main worries was that /usr/games was avoided for some reason, since most of the ones I have installed from the official repos don't install there. smile

Thanks for the suggestion, MrCode.

Offline

Board footer

Powered by FluxBB