Re: Docklet(ing) API & 10.1: Where ????
Re: Docklet(ing) API & 10.1: Where ????
- Subject: Re: Docklet(ing) API & 10.1: Where ????
- From: "Craig S. Cottingham" <email@hidden>
- Date: Fri, 5 Oct 2001 13:02:53 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Friday, October 5, 2001, at 06:05 , email@hidden wrote:
3. In order to launch from the StartupItems folder the executable to be
launched must be placed in a sub-folder of StartupItems and
have the same
name of the folder it exists in. I tried a number of different
approaches
but I could not get this to accept an app package as a startup item. It
seems the executable must exist at the top level of the sub-folder and
therefore StartupItems cannot be app packages (bundles). The
bundle support
for StartupItems items is limited to localizing the startup string
displayed during boot up.
That's not entirely true. The process that launches startup
items looks in subdirectories of StartupItems for files with the
same name as their enclosing folders, and attempts to execute
them. The file that gets executed can, in turn, launch code
located in a completely different place.
For instance, here's the StartupItem for PostgreSQL that I created:
#!/bin/sh
##
# Start PostgreSQL
##
. /etc/rc.common
if [ "${POSTGRESQL:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Starting PostgreSQL"
LD_LIBRARY_PATH=/usr/local/pgsql/lib
PATH=/usr/local/pgsql/bin:$PATH
export LD_LIBRARY_PATH PATH
rm -f /Users/postgres/data/postmaster.pid
su postgres -c "pg_ctl start -w -o '-i' -D
/Users/postgres/data -l /Users/postgres/postgres.log"
fi
This is in a file named
/Library/StartupItems/PostgreSQL/PostgreSQL. Note that it
executes the script /usr/local/pgsql/bin/pg_ctl, which in turn
executes /usr/local/pgsql/bin/postmaster. So, to start an
application in a package at StartupItem time, you just reference
the executable part of the package in your StartupItem (probably
after setting up PATH and who knows what else first). For
(purely hypothetical) example,
#!/bin/sh
. /etc/rc.common
if [ "${MAIL_APP:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Starting Mail.app"
/Applications/Mail.app/Contents/MacOS/Mail &
fi
There are doubtless many, many reasons the above script won't
work. I suspect they have more to do with the way Mail is coded
than with application packages in general.
- --
Craig S. Cottingham
email@hidden
PGP key available from:
<
http://pgp.ai.mit.edu:11371/pks/lookup?op=get&search=0xA2FFBE41>
ID=0xA2FFBE41, fingerprint=6AA8 2E28 2404 8A95 B8FC 7EFC 136F
0CEF A2FF BE41
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (Darwin)
Comment: For info see
http://www.gnupg.org
iD8DBQE7vfXUE28M76L/vkERAtWAAKCg+mcUXFpaUOBUIHnAwAVxo7SONwCg/3ZZ
YBUd7/Pim4D0zE5+oZf6YFI=
=4Vo3
-----END PGP SIGNATURE-----