preinstall.sh 728 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. # ngIRCd Mac OS X preinstall/preupgrade script
  3. LDPLIST="/Library/LaunchDaemons/de.barton.ngircd.plist"
  4. rm -f /tmp/ngircd_needs_restart || exit 1
  5. if [ -r "$LDPLIST" ]; then
  6. echo "LaunchDaemon script found, checking status ..."
  7. launchctl list | fgrep "de.barton.ngIRCd" >/dev/null 2>&1
  8. if [ $? -eq 0 ]; then
  9. # ngIRCd is already running; stop it and touch a
  10. # "stamp file" so that we know that we have to
  11. # restart it after installation/upgrade.
  12. echo "ngIRCd is already running; stop it ..."
  13. launchctl unload "$LDPLIST" || exit 1
  14. echo "Daemon has been stopped."
  15. touch /tmp/ngircd_needs_restart || exit 1
  16. else
  17. echo "ngIRCd is not running."
  18. fi
  19. else
  20. echo "LaunchDaemon script not found."
  21. fi
  22. # -eof-