You are not logged in.

#1 2007-10-14 21:40:34

Wesley
Member
From: Hannover, Germany
Registered: 2007-07-13
Posts: 33

.install files and how they should work

hi
i already looked up the wiki and the forum and found nothing realy related to this.
i am able to set an .install script in the PKGBUILD, but i would like to know how it should work.

i got an game that i would like to add to the AUR but the problem is that its not actually creating a hidden folder in home to save the settings and all.
so i would like to move all the config files and ofcourse the save directory to a hidden home folder and link it to /usr/share/{game}.
i know that i cant do that while building the package itself, but i would like to know WHEN this install script gets executet.
in my opinion, this install script should do what i told above, move the files, link it to the destination.
so, is there actually a site where i can lookup the install= command?

Offline

#2 2007-10-14 22:30:57

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: .install files and how they should work

No, the install script doesn't touch any user's home dir. If the developers haven't taken care of this upstream (and they REALLY should have), you could write a wrapper that does the hidden folder magic and then launches the app. Ideally, though, you should nag the devs until they fix it. smile

There's no mystery to .install files - the generic template is in /var/abs (if it isn't, run the abs command), and there are also numerous working examples for various packages there, and in the AUR.

Offline

#3 2007-10-14 22:35:45

Wesley
Member
From: Hannover, Germany
Registered: 2007-07-13
Posts: 33

Re: .install files and how they should work

ok, but i got 2 problems:
the code istn free, so you cant actually compile it with the argument WHERE to save what.
the second is that the game developer already statet that he WHONT code on the game anymore, only to bugfix things.
and to ask him for a custom version (since the currentversions are to extract, patch, play purposes) would stress my connection to him a little bit to much (u need to know, i bug him the whole day about wich dep's are needed and under wich license it is released...^^

EDIT
what exactly do you mean with wrapper?
im sorry but i cant actually imageine nothing under a "wrapper", like executing the app while linking these called directorys and config files to the home dir?
a little example would be very kind ( tongue )

EDIT2
please dont understand me wrong, i dont whant a finished 'wrapper' to launch the app the way i would like to, i would just get an idea on how i should approach it.

Last edited by Wesley (2007-10-14 22:52:47)

Offline

#4 2007-10-14 23:11:37

Cerebral
Forum Fellow
From: Waterloo, ON, CA
Registered: 2005-04-08
Posts: 3,108
Website

Re: .install files and how they should work

usually, in cases like the one you describe, what packagers do is chown the data dir of the game to the 'games' group, then do the same for the game executable, setting the group sticky bit (chmod g+s /path/to/game) - this allows the game to always run as a member of the games group, and thus have write access to the datadir.

-edit-

so basically, you'd do

# following two lines allow the game executable to run as a member 
# of the games group
chgrp games /usr/bin/{game}
chmod g+s /usr/bin/{game}
# following two lines set the group of the game's datadir to 'games', 
# allowing the executable to write to that dir
chgrp games /usr/share/{game}
chmod g+s /usr/share/{game}

Last edited by Cerebral (2007-10-14 23:13:55)

Offline

#5 2007-10-14 23:54:46

Wesley
Member
From: Hannover, Germany
Registered: 2007-07-13
Posts: 33

Re: .install files and how they should work

thank you for that cerebral.
but actually, you do know that just saying "use chmod and chgrp" would be enough?
that is the second time you did a essential part of the work for me, if you repeat that to often, i will never learn tongue
back to topic:
isnt giving write acces to directorys within /usr or /opt a very very ugly workaround?
i mean, even if its not that easy to solve it otherwise...

EDIT
i played around a little bit with your tip of changing the group, but i came to a point where i am stuck.
the starterscript itself just cd's into /opt/StarTrade(the game) and runs the, um... 'other' starterscript 'StarTrade'.
the starter in the game directory contains the following lines:

#!/bin/bash
exec_path=`dirname $0`
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$exec_path $exec_path/engine.x86

this is because the game itself got the fmod lib within the directory, as far as i heard because its to exotic or... um... whatever^^
so, if you start this script you get the following messege:

appstub.linux signal handler 11/opt/StarTrade/StarTrade: line 3: 21018 Speicherzugriffsfehler  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$exec_path $exec_path/engine.x86

starting it from the pkg/ directory where you packet it WILL work, maybe because it is in my $HOMEspace, i dont really know

EDIT2
and it whont work if it is startet with the 'games' group, even if it is installed in $HOME

EDIT3
finaly it worked, i wrote a sript that backs up all "need write access" files to a backup/ directory and copys them to a .homedirectory, the only question is, "will it work on multi-user systems?"
i cant test this now, i didnt even testet the pack itself because my "testdummy-of-choice" is currently offline, but thankyou for your help

Last edited by Wesley (2007-10-15 15:31:24)

Offline

#6 2007-10-28 04:12:12

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: .install files and how they should work

hi wesley,

why don´t you write a  bash start-up script that, run for the first time, makes the necessary folder and files in the users directory? you only have to link the needed files in that particular directory. when you run the script again, it checks if there is already a folder in $HOME, then changes into that directory  directory (cd) and then starts the game from that directory. so you can save the user settings in the home dir.
for example, i made a similar script for epsxe:

#!/bin/bash

GAMEDIR="/opt/epsxe"
HOME_GAMEDIR="${HOME}/.epsxe/"

if [[ -d ${HOME_GAMEDIR} ]]; then
    cd ${HOME_GAMEDIR}
    ./epsxe $*
else
    mkdir ${HOME_GAMEDIR} && cd ${HOME_GAMEDIR}
    ln -s ${GAMEDIR}/bios
    ln -s ${GAMEDIR}/epsxe
    ln -s ${GAMEDIR}/keycodes.lst
    ln -s ${GAMEDIR}/plugins/
    cp -ri ${GAMEDIR}/cfg .
    cp -ri ${GAMEDIR}/cheats .
    mkdir memcards
    mkdir snap
    ./epsxe $*
fi

as you see, it has the same structure like the original directory, but now you can save all settings, scores locally whithout manipulating anything in /.

vlad

Last edited by DonVla (2007-10-28 04:13:18)

Offline

#7 2007-12-14 08:23:13

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: .install files and how they should work

Cerebral wrote:

/usr/share/{game}

Coming from Gentoo, it's not clear in Arch where to put game-related files.

Even in /usr/, there's ambiguity over where to put the game directory:

/usr/games
/usr/share
/usr/share/games

Then there's game libs:

/usr/lib
/usr/lib/games
/usr/games/lib

And shared game files (e.g. highscores) - hopefully there's just one choice:

/var/games

And for binary-only (commercial) games - hopefully there's just one choice:

/opt

Is there (hopefully) a consensus for the /usr game dirs? This is "important" for games like the Quake series, which can have several game engines sharing the same game directories.

Edit: Added /usr/lib/games

Last edited by brebs (2007-12-18 11:18:58)

Offline

Board footer

Powered by FluxBB