]> arthur.barton.de Git - ngircd-alex.git/blob - contrib/MacOSX/postinstall.sh
Fix typo: Please not -> Please note
[ngircd-alex.git] / contrib / MacOSX / postinstall.sh
1 #!/bin/sh
2 # ngIRCd Mac OS X postinstall/postupgrade script
3
4 LDPLIST="/Library/LaunchDaemons/de.barton.ngircd.plist"
5
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
9 else
10         echo "/etc/ngircd already exists. Don't create symlink."
11 fi
12
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
17 else
18         echo "/opt/ngircd/etc/ngircd.conf exists. Don't copy sample file."
19 fi
20 chmod o-rwx /opt/ngircd/etc/ngircd.conf
21
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
28 fi
29 chmod 644 /opt/ngircd/etc/ngircd.pam
30
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
34 fi
35
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
40 fi
41
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."
48         else
49                 echo "LaunchDaemon script not installed. Can't start daemon."
50         fi
51 else
52         echo "Not loading LaunchDaemon script."
53 fi
54 rm -f /tmp/ngircd_needs_restart
55
56 # -eof-