On 10/1/07, Ryan Schmidt <ryandesign@macports.org> wrote:
In the current way, the symlink is made in the destroot and handled just like any other file in the port's manifest. On activate, it is installed to the right place. On deactivate, it is removed. To start the service, you "launchctl load" it and to stop it, you "launchctl unload" it. This is all fairly easy and works.
This assumes that people deactivate or otherwise that allow MacPorts to clean up after itself. rm -rf /opt/local would leave those broken symlinks. They don't really matter but as I said earlier, the "nothing outside /opt/local" rule is bent in some cases, this being one. And as for invoking launchct load statements, how is this different? launchctl load /opt/local/etc/LaunchDaemons/org.macports.dbus/org.macports.dbus.plist launchctl load /opt/local/etc/LaunchDaemons/org.macports.apache2/org.macports.apache2.plist launchctl load /opt/local/etc/LaunchDaemons/org.macports.mysql5/org.macports.mysql5.plist from putting the plists in launchd's default search path? As configured, launchctl looks in two places for plists: in /System/Library/LaunchDaemons, for Apple-owned stuff, in /Library/LaunchDaemons for user-installed/third-party stuff. I don't see a big deal about another repository for plists. Maybe in future releases launchd will allow additional directories to be added instead of individual lines. Your way would require someone to manually edit the file /etc/
launchd.conf, at least to remove a line from it. That's more complicated than the current way, where a single launchctl line starts or stops the service. Also, with your way, the service wouldn't start or stop until the next startup. That's worse than what we have now, where the service starts or stops immediately.
see above: if launchctl works as it says on the tin, there is not different between symlinks that point to /Library/LaunchDaemons and the lines I have in /etc/launchd.conf. Running a single launchctl command to start or stop a service is
easy. Conversely, adding a line to a file is easy, as you showed, but removing a line from a file requires a more elaborate script. So why change it to make it more difficult?
I'm not arguing in favor of it. I'm just explaining it. I have a hard time believing that, given the power on tap, that there is no way to add a commented line to /etc/launchd.conf launchctl load /opt/local/etc/LaunchDaemons/org.macports.dbus/org.macports.dbus.plist # installed by macports and add a # character to the beginning of the line containing the comment: sed -e s/^launchctl/#&/g <- yes, I know that won't work, but you get the idea: sed is not my native language. There's a slight problem with the current way. If the service is
running at the time that you uninstall the port, the software stays running. And if the service is running at the time that you upgrade the port, the old version stays running and the new version's plist says the software isn't running and it's inconvenient to fix that (manually edit the plist to show that the software is running, launchctl unload the software, launchctl load it again). Would your new way solve either of these problems? (I haven't tried so I don't know.)
Is there no pre-install step that could stop the service with the existing plist, install, restart? Again, I'm not arguing in favor of doing it this way, I'm just explaining it. Perhaps if it's more clearly understood, a comparison can be made. -- Paul Beard / www.paulbeard.org/ <paulbeard@gmail.com/paulbeard@mac.com>