postinstall.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh
  2. # ngIRCd Mac OS X postinstall/postupgrade script
  3. LDPLIST="/Library/LaunchDaemons/de.barton.ngircd.plist"
  4. if [ ! -e /etc/ngircd ]; then
  5. echo "Creating symlink: /opt/ngircd/etc -> /etc/ngircd"
  6. ln -s /opt/ngircd/etc /etc/ngircd || exit 1
  7. else
  8. echo "/etc/ngircd already exists. Don't create symlink."
  9. fi
  10. if [ ! -e /opt/ngircd/etc/ngircd.conf ]; then
  11. echo "Creating default configuration: /opt/ngircd/etc/ngircd.conf"
  12. cp /opt/ngircd/share/doc/ngircd/sample-ngircd.conf \
  13. /opt/ngircd/etc/ngircd.conf || exit 1
  14. else
  15. echo "/opt/ngircd/etc/ngircd.conf exists. Don't copy sample file."
  16. fi
  17. chmod o-rwx /opt/ngircd/etc/ngircd.conf
  18. if [ -f "$LDPLIST" ]; then
  19. echo "Fixing ownership and permissions of LaunchDaemon script ..."
  20. chown root:wheel "$LDPLIST" || exit 1
  21. chmod 644 "$LDPLIST" || exit 1
  22. fi
  23. if [ -f /tmp/ngircd_needs_restart ]; then
  24. echo "ngIRCd should be (re-)started ..."
  25. if [ -r "$LDPLIST" ]; then
  26. echo "LaunchDaemon script found, starting daemon ..."
  27. launchctl load -w "$LDPLIST" || exit 1
  28. echo "OK, LaunchDaemon script loaded successfully."
  29. else
  30. echo "LaunchDaemon script not installed. Can't start daemon."
  31. fi
  32. else
  33. echo "Not loading LaunchDaemon script."
  34. fi
  35. rm -f /tmp/ngircd_needs_restart
  36. # -eof-