source: trunk/dports/mail/vm-pop3d/Portfile @ 15951

Last change on this file since 15951 was 15951, checked in by mww, 12 years ago

replace hard-coded '/opt/local' (was post-install msg only)

  • Property svn:eol-style set to native
File size: 5.8 KB
Line 
1# $Id: Portfile,v 1.3 2006/01/21 13:59:15 mww Exp $
2
3PortSystem      1.0
4
5name                            vm-pop3d 
6version                         1.1.6
7
8categories                      mail
9maintainers                     markd@opendarwin.org
10platforms                       darwin
11
12description                     POP3 server for Postfix that supports virtual domains and mailboxes
13
14long_description                A POP3 server that supports virtual domains and virtual mailboxes \
15                                such that users and mailboxes need not be associated with local\
16                                Unix accounts.
17
18homepage                        http://www.reedmedia.net/software/virtualmail-pop3d/
19                                       
20master_sites                    http://www.ibiblio.org/pub/Linux/system/mail/pop/ \
21                                ftp://sunsite.unc.edu/pub/Linux/system/mail/pop/
22
23checksums                       md5 0399cc06f5329a6eaebec05d959a6ec1
24
25destroot.destdir                prefix=${destroot}${prefix}
26
27depends_lib                     port:postfix \
28                                port:DarwinPortsStartup
29
30configure.args                  --enable-virtual
31
32pre-configure {
33# Set vm-pop3d.h apop file path
34        reinplace "s|/etc/apop|${prefix}/etc/${name}/apop|g" \
35                "${worksrcpath}/vm-pop3d.h"
36
37# Set vm-pop3d.h virtual directory domain spool path
38        reinplace "s|/var/spool/virtual|${prefix}/var/${name}/spool|g" \
39                "${worksrcpath}/vm-pop3d.h"
40
41# Set vm-pop3d.h virtual directory domain password path
42        reinplace "s|/etc/virtual|${prefix}/etc/${name}|g" \
43                "${worksrcpath}/vm-pop3d.h"
44}
45
46post-destroot {
47# Create spool and passwd file paths for the virtual domains
48        xinstall -m 755 -d ${destroot}${prefix}/var/${name}/spool
49        xinstall -m 755 -d ${destroot}${prefix}/etc/${name}
50        system "chown postfix:postfix ${destroot}${prefix}/var/${name}/spool"
51
52# Create lock file path
53        xinstall -m 755 -d ${destroot}${prefix}/var/${name}/lock
54
55# Keep the empty virtual spool and passwd file paths
56destroot.keepdirs \
57        ${destroot}${prefix}/var/${name}/spool \
58        ${destroot}${prefix}/var/${name}/lock \
59        ${destroot}${prefix}/etc/${name}
60
61# Install documentation type stuff
62        xinstall -d ${destroot}${prefix}/share/doc/${name}
63        xinstall -m 644 ${worksrcpath}/AUTHORS ${destroot}${prefix}/share/doc/${name}
64        xinstall -m 644 ${worksrcpath}/CHANGES ${destroot}${prefix}/share/doc/${name}
65        xinstall -m 644 ${worksrcpath}/COPYING ${destroot}${prefix}/share/doc/${name}
66        xinstall -m 644 ${worksrcpath}/FAQ ${destroot}${prefix}/share/doc/${name}
67        xinstall -m 644 ${worksrcpath}/INSTALL ${destroot}${prefix}/share/doc/${name}
68        xinstall -m 644 ${worksrcpath}/README ${destroot}${prefix}/share/doc/${name}
69        xinstall -m 644 ${worksrcpath}/TODO ${destroot}${prefix}/share/doc/${name}
70
71# Fix and copy the init script
72        reinplace "s|daemon vm-pop3d|${prefix}/sbin/vm-pop3d --user postfix --group postfix|g" \
73                "${worksrcpath}/vm-pop3d.init"
74
75        reinplace "s|/usr/local/sbin|${prefix}/sbin|g" \
76                "${worksrcpath}/vm-pop3d.init"
77
78        reinplace "s|/var/lock/subsys|${prefix}/var/${name}/lock|g" \
79                "${worksrcpath}/vm-pop3d.init"
80
81        reinplace "s|killproc|killall|g" \
82                "${worksrcpath}/vm-pop3d.init"
83
84        reinplace "s|/etc/rc.d/init.d/functions|/etc/rc.common|g" \
85                "${worksrcpath}/vm-pop3d.init"
86
87        xinstall -d -m 755  ${destroot}${prefix}/etc/rc.d
88       
89        xinstall -m 755 ${worksrcpath}/vm-pop3d.init ${destroot}${prefix}/etc/rc.d/vm-pop3d.sh
90}
91
92post-activate {
93
94ui_msg "\n#### To setup vm-pop3d with Postfix ####
95
96Notice: The paths to files used by vm-pop3d are hard coded at compile time so
97         if you deviate from the paths described below vm-pop3d will not work.
98
991) Setup Postfix (if first-time setup) and create spool directories
100   for your vm-pop3d virtual domains.
101
102        cd ${prefix}/etc/postfix
103        sudo cp master.cf.sample master.cf
104        sudo cp main.cf.sample main.cf
105 
106        sudo mkdir ${prefix}/var/${name}/spool/my-vdomain1.com
107        sudo chown postfix:postfix ${prefix}/var/${name}/spool/my-vdomain1.com
108        sudo chmod 775 ${prefix}/var/${name}/spool/my-vdomain1.com
109
110
1112) Configure Postfix for virtual mailboxes
112
113   Add to main.cf
114
115        virtual_mailbox_base = ${prefix}/var/${name}/spool
116        virtual_mailbox_maps = hash:${prefix}/etc/${name}/vmailbox_maps
117        virtual_mailbox_domains = hash:${prefix}/etc/${name}/vdomain_maps
118        virtual_uid_maps = static:<postfix user's uid>
119        virtual_gid_maps = static:<postfix user's gid>
120        virtual_mailbox_lock = dotlock
121        virtual_minimum_uid = <postfix user's uid>
122
123   NOTE: Do NOT include the virtual domain name in main.cf's \$mydestination
124         or Postfix will reject mail to this domain since local (Unix) accounts
125         for virtual domains do not exist.
126
127
1283) Create virtual mailbox lookup tables
129
130        sudo touch ${prefix}/etc/${name}/vdomain_maps (contents below)
131
132   my-vdomain1.com     placeholder (any text)
133   my-vdomain2.com     placeholder
134
135        sudo touch ${prefix}/etc/vm-pop3d/vmailbox_maps (contents below)
136
137   user1@my-vdomain1.com         my-vdomain1.com/user1
138   user2@my-vdomain1.com         my-vdomain1.com/user2
139
140        sudo postmap ${prefix}/etc/${name}/vdomain_maps (make .db hash files)
141        sudo postmap ${prefix}/etc/${name}/vmailbox_maps
142
143
1444) Restart Postfix and test SMTP message delivery to virtual domains
145
146        sudo postfix reload
147
148   Now send an email to an account in a virtual domain; look here to see if
149   messages are arriving:
150
151        ls ${prefix}/var/${name}/spool/my-vdomainx.com for messages.
152
153   Check the error logs for either delivery errors or (after next step)
154   POP errors:
155
156        tail /var/log/mail.log
157
158
1595) Create virtual domain passwd files, substituting real domain names for my-vdomain
160
161        cd ${prefix}/etc/${name}
162        sudo mkdir my-vdomain1.com
163        cd my-vdomain1.com
164        sudo htpasswd -c passwd user1 (-c creates the file 'passwd' to hold the 1st vdomain1 user)
165        sudo htpasswd passwd user2 (don't need -c for subsequent users of the vdomain1)
166
167
1686) Start vm-pop3d and test POP access to a virtual domain with telnet
169
170        sudo ${prefix}/etc/rc.d/vm-pop3d.sh start (or reboot)
171
172        telnet localhost 110  (response ->)  +OK POP3 Welcome to vm-pop3d 1.x.x
173        USER <user@domain>
174        PASS <password>
175        LIST (to see messages)
176        RETR 1 (to view message #1)
177
178   Documentation is in ${prefix}/share/doc/${name}\n"
179}
Note: See TracBrowser for help on using the repository browser.