UNIX/Linux installation directories

  • CJP

    CJP - 2005-06-10

    Where should "make install" place the binaries, data files and configuration files? I'd like to know your opinion about this.

    1: We should follow file hierarchy standards as much as possible. Which standards apply to Ultimate Stunts?
    2: Locations should be relative to the configure --prefix argument. Are there things that should be placed outside the prefix dir (e.g. in /etc, or in the user's homedir)?
    3: Users should be able to create tracks, update highscores, change the configuration settings etc.. In other words: some files should be user-writable. What are the correct locations for these things? User-created tracks should probably be shared amongst users, but a config file is private. On the other hand, there should probably be a "default" configuration file in a global location.
    4: I have plans for implementing a system that can "merge" different datafile locations at runtime, so that Ultimate Stunts can treat files on different locations as if they were in one single directory. This could be useful, for instance to merge a global directory of installed tracks, and a directory of user-created and downloaded tracks.
    5: How do other games deal with these problems?

    • CJP

      CJP - 2005-06-10

      My own ideas for future versions (this is not yet implemented):

      * Let the default prefix be /usr/local
      * Install binaries in ${prefix}/bin
      * Install data files in ${prefix}/share/ultimatestunts
      * Install a standard conf file in ${prefix}/etc, or in /etc if ${prefix} is /usr, with a datadir value that refers to ${prefix}/share/ultimatestunts

      First start by a user:
      * Find the standard ultimatestunts.conf file location:
          try [location of binary]/../etc
          try /etc
          try /usr/local/etc
      * Create a ~/.ultimatestunts directory
      * Copy the conf file to ~/.ultimatestunts
      * Modify the conf file so that ~/.ultimatestunts is added as a datadir

      Later starts by a user (when ~/.ultimatestunts exists):
      * Use ~/.ultimatestunts/ultimatestunts.conf

      Data file behaviour:
      * In reading, ~/.ultimatestunts gets priority over ${prefix}/share/ultimatestunts
      * Writing and creating files is only done in ~/.ultimatestunts

      • Werner Macho

        Werner Macho - 2005-06-10

        i overlooked your suggestions and .. well theres nothing to add ..
        good ideas ..

    • bones

      bones - 2005-06-10

      Hi CJP,
      my suggestion is not to complicate things to much. :-)
      Most players will (hopefully) get the game from their distribution in the future and they will repack the package anyways.
      On a debian system games are packed like this:
      /usr/games/  - all binaries.
      /usr/share/games/game_name/ - all data
      ...just as an example.

      Otherwise I'd also vote for your ideas, except that you should not go above the --prefix. If prefix is /usr , use /usr/etc , not /etc .

      Personally I like to have my games just in my home directory, so I would either not run "make install" if possible or set the prefix to $HOME/ultimate_stunts .

      Data written by the game or the editor should go into $HOME/.ultimatestunts/ and should have the same structure. Then these files could overload the default (shared) data like tracks/cars whatever. Maybe you can simply modify the loader to first check the shared files but if there are user-files with same name/location, take those, otherwise the shared ones.

      Keep on the great work!


    • Anonymous - 2005-06-10


      I looked at the File Hierarchy Standard (FHS), and games are mentioned a few times:

      It confirms the use of /usr/games for binaries, and /usr/share/games/<game-name>/ for arch-independent static data.

      However, if prefix is /usr, you "must" use /etc, not /usr/etc (it is stated that /usr/etc is *still* not allowed):

      Score files could be stored in ~/.ultimatestunts/ (the simplest, if you don't want to deal with group and permissions), and/or in /var/games/ultimatestunts, which would require a specific group to be created and binaries needing it to be setgid:

      A clean "upstream" install will greatly help the per-distro packaging. Slight differences between distro policies will be dealt with packaging system. So better follow the FHS since I guess most distros tend to go that way...



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks