On Feb 15, 2007, at 12:31 PM, Benjamin Lam wrote: What is the recommended way to install something into /Library/StartupItems? I need to put some items in there, can I just create the Library/StartupItems structure with the items when I create the package or should I copy the items in during postflight? If I just create the package with the Library/StartupItems structure and if other software puts items in there, then my package runs, it won’t ‘reset’ the Library/StartupItems folder will it, deleting the other items (to match the given structure in my package) will it?
That folder is just a folder... so you can drop a folder in there called "MyItem" or whatever you want and then put the plist and binary or script in there and it will run. Just make sure you use the right permissions as Tiger is strict about permissions or you get an error on next reboot saying it needs to fix the permissions. You can either copy it in with a preflight or you can write it directly in the PKG. It's honestly whichever way you want.
Here is a script I added and the permissions for it. Below that is the startupparameters.plist file contents for my particular item. The only problem you could run in to is that you call your item the same thing as someone elses and you stomp on them so try to be unique about the name you use.
#ls -ld /Library/StartupItems/MTU/ drwxr-xr-x 4 root wheel 136 Nov 7 09:53 /Library/StartupItems/MTU/
#ls -l /Library/StartupItems/MTU/ total 16 -rwxr-xr-x 1 root wheel 637 Nov 7 09:50 MTU -rwxr-xr-x 1 root wheel 544 Sep 13 2005 StartupParameters.plist
---- StartupParameters.plist -----
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" " http://www.apple. com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Description</key> <string>Can set MTU</string> <key>OrderPreference</key> <string>None</string> <key>Provides</key> <array> <string>MTU</string> </array> <key>Requires</key> <array> <string>Network Configuration</string> </array> </dict> </plist>
|