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 [ ! -e /opt/ngircd/etc/ngircd.pam ]; then
23 echo "Creating default PAM configuration: /opt/ngircd/etc/ngircd.pam"
24 echo "# PAM configuration for ngIRCd" >/opt/ngircd/etc/ngircd.pam
25 echo "" >>/opt/ngircd/etc/ngircd.pam
26 echo "auth required pam_permit.so" >>/opt/ngircd/etc/ngircd.pam
27 echo "#auth required pam_opendirectory.so" >>/opt/ngircd/etc/ngircd.pam
29 chmod 644 /opt/ngircd/etc/ngircd.pam
31 if [ ! -e /etc/pam.d/ngircd ]; then
32 echo "Linkint /opt/ngircd/etc/ngircd.pam to /etc/pam.d/ngircd"
33 ln -s /opt/ngircd/etc/ngircd.pam /etc/pam.d/ngircd || exit 1
36 if [ -f "$LDPLIST" ]; then
37 echo "Fixing ownership and permissions of LaunchDaemon script ..."
38 chown root:wheel "$LDPLIST" || exit 1
39 chmod 644 "$LDPLIST" || exit 1
42 if [ -f /tmp/ngircd_needs_restart ]; then
43 echo "ngIRCd should be (re-)started ..."
44 if [ -r "$LDPLIST" ]; then
45 echo "LaunchDaemon script found, starting daemon ..."
46 launchctl load -w "$LDPLIST" || exit 1
47 echo "OK, LaunchDaemon script loaded successfully."
49 echo "LaunchDaemon script not installed. Can't start daemon."
52 echo "Not loading LaunchDaemon script."
54 rm -f /tmp/ngircd_needs_restart