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