Something I've been thinking about as I created the Mac app build is how to deal with user configuration/prefs, addon modules, and locating files outside the main grass installation.
I'm coming from an OSX point of view, but much of this is applicable to other platforms. And now there has been some recent discussion on this, including an emerging need for user configuration in the new wx gui.
The core of the issue is that with a binary installation (ie not built from source), a non-admin user will not be able to add to the main GRASS installation. And, it's not safe to add files, because an update to GRASS may overwrite or delete the files that have been added. ie a drag-n-drop installation will overwrite the whole thing.
In an OSX environment, the standard thing to do is have user addons and configuration in their home/Library folder, and other 3rd-party addons you want to be available to all users in a global location, /Library. Or:
~/Library/Application Support
/Library/Application Support
The "Application Support" part could be dropped to make sure there are no problems by having a space in its name. There shouldn't be a problem, but I've run into random problems in the GUI.
Other platforms would have their own set of standard global and user locations. ie ~/.grass on Linux, and somewhere in the user's Application Data or Local Settings in Windows.
Currently, in my OSX build I use:
$HOME/Library/GRASS/$GRASS_MAJOR_VERSION.$GRASS_MINOR_VERSION
I use a Modules subdir for user installed addon modules. The global /Library/GRASS dir is also used, but accessed thru the user dir.
Jachym suggested a GRASS env variable: GRASSRCDIR, to store the location of this GRASS user dir. It should be set by configure, with appropriate defaults for each platform.
Currently, much of this is easily handled by standard unix/shell stuff, or current GRASS features:
bin - handled by GRASS_ADDON_PATH
lib - handled by [DY]LD_LIBRARY_PATH
I use this in my custom grass startup for OSX to set the extra user and global paths. What are missing are docs and etc and some way to configure the GUI menus without editing the installed menu files (like GEM currently does).
- docs - tricky - adding links to the installed GRASS docs to a user's home hardwires it to that user. I tried using ~/ in the links, but this only works in Safari. Firefox and probably other browsers don't understand (probably the right way) ~ as $HOME.
In OSX the only way I could get a dynamic user help was to use the OSX Help Viewer. Windows might have something similar that could be used, but I don't know about Linux systems.
- etc - for modules and user scripts that have support files that should be stored in etc/. A function should be added to libgis to locate a file in any of the defined extra locations. ie ~/Library/GRASS/6.3/Modules/etc, or $GRASSRCDIR/Modules/etc. It should be available to scripts as well.
Something like G_find_file_etc("module_data_file"). If I can wrap my head around "real" C programming (as opposed to just tinkering/tweaking), I might try taking the G_find_file() as a starting point and see if I can work this out.
- menu config - the gui would have to load user and global menu files, in addition to its builtin menu file. Adding to those menus would have to be handled by the addon installer, or even have the GUI provide a menu edit feature to let the user easily customize their personal menu.
Currently I have the OSX startup build a menu file from available addons, it's just waiting for a TclTk GUI update to be able to load these.
- GEM - Currently it's setup to install all files into the GRASS binary space. GEM should be expanded to install in the external location(s). Preferrably by default.
- Existing files - to be consistent and tidy, existing config/pref files could be moved into this (and unhidden, on OSX and Windows at least) - .grassrc6, .grass_bashrc, GIS_ERROR_LOG. Or moved to more appropriate locations, such as (for OSX) ~/Library/Preferences and ~/Library/Logs, but this would need more env variables for the extra dirs.
-----
William Kyngesburye <kyngchaos@kyngchaos.com>
http://www.kyngchaos.com/
"We are at war with them. Neither in hatred nor revenge and with no particular pleasure I shall kill every ___ I can until the war is over. That is my duty."
"Don't you even hate 'em?"
"What good would it do if I did? If all the many millions of people of the allied nations devoted an entire year exclusively to hating the ____ it wouldn't kill one ___ nor shorten the war one day."
<Ha, ha> "And it might give 'em all stomach ulcers."
- Tarzan, on war