Configuring the Shell Environment
Many programs used for MRI research require certain environment variables to be set. For example, FSL requires $FSLDIR to point to the location of the FSL installation. AFNI requires AFNI_PLUGIN_PATH to point to the location of plugins and images.You can manually set these variables in your startup script (e.g. .cshrc or .profile).
Example (for FreeBSD AFNI port):
setenv AFNI_PLUGIN_PATH /usr/local/share/afni:/usr/local/lib/afni setenv AFNI_GLOBAL_SESSION /usr/local/share/afniExample (for MacPorts AFNI port):
setenv AFNI_PLUGIN_PATH /opt/local/share/afni:/opt/local/lib/afni setenv AFNI_GLOBAL_SESSION /opt/local/share/afniStartup Script "Plugins"
As an alternative to manual setup shown above, many MRI ports include configuration scripts to automaticaly perform this setup.How it Works
Each port installs two scripts named portname.cshrc and portname.profile into the directory /usr/local/etc/mri (FreeBSD) or /opt/local/etc/mri (Mac).If you're running a C shell compatible shell (e.g. csh or tcsh), simply source all of the portname.cshrc files from your .cshrc. This will configure your shell environment for all installed ports that provide a script.
If you're using a Bourne shell compatible shell (e.g. sh, bash, ksh), simply source all of the portname.profile scripts from your .profile (or .bashrc if you prefer).
The advantage of this is that you don't need to modify your startup script every time a port is installed, uninstalled, or upgraded. Just add the code to source the ports' "plugins" once, and the plugins will effectively become part of your startup script. As the ports change, so do the plugins, and your environment will automatically change accordingly the next time you open a new shell.
Examples
Below are examples of how to set up a .cshrc or .profile to utilize this feature of ports. Once you add this code, it should not be necessary to modify the .cshrc or .profile again in order to keep the ports working. (You may of course, want to add some optional customizations, but all ports should work with just the example code shown below.)C shell example:
switch(`uname`) case FreeBSD: set ports_prefix = "/usr/local" breaksw case Darwin: set ports_prefix = "/opt/local" breaksw endsw if ( -e ${ports_prefix}/etc/mri ) then foreach script (${ports_prefix}/etc/mri/*.cshrc) source ${script} end endifBourne shell example:case `uname` in FreeBSD) ports_prefix="/usr/local" ;; Darwin) ports_prefix="/opt/local" ;; *) ;; esac if [ -e ${ports_prefix}/etc/mri ]; then for script in ${ports_prefix}/etc/mri/*.profile; do . ${script} done fi