Start Me Up: Writing and Understanding OS X StartupItems
Subject:   /Library/StartupItems and Fink's
Date:   2003-12-20 12:13:24
From:   anonymous2
printenv > somelogfile.log shows that the startup items are run in a minimalistic environment -- after rc.common is loaded, only PATH, SHLVL, and _ are defined! The problem is, this means that the if [ -z "$FOO" ] etc. clauses in fink's will fail when variable FOO isn't already defined, and so using apache2 or popfile (which I have configured to use BerkeleyDB from fink) means starting them by hand.

The solution was to copy /sw/bin/ to /etc/ (or whatever), trim down the various variable-defining conditionals in (such as if [ -z "$MANPATH"] ... fi) with the knowledge that $PATH exists and the rest don't, replacing them with the appropriate consequence or alternative. Then, adding ". /etc/" after pulling in rc.common makes everything work.