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

Last change on this file since 16101 was 16101, checked in by markd, 13 years ago

Bug:
Submitted by:
Reviewed by:
Approved by:
Obtained from:
Port revision to use new DP startup scripts

  • Property svn:eol-style set to native
File size: 6.0 KB
Line 
1# $Id: Portfile,v 1.4 2006/01/27 08:34:21 markd Exp $
2
3PortSystem      1.0
4
5name                            vm-pop3d 
6version                         1.1.6
7revision                        1
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
29configure.args                  --enable-virtual
30
31
32variant server {
33
34    startupitem.create    yes
35    startupitem.start "${prefix}/share/${name}/vm-pop3d.init"
36    startupitem.stop "killall ${name}"
37}
38
39pre-configure {
40# Set vm-pop3d.h apop file path
41        reinplace "s|/etc/apop|${prefix}/etc/${name}/apop|g" \
42                "${worksrcpath}/vm-pop3d.h"
43
44# Set vm-pop3d.h virtual directory domain spool path
45        reinplace "s|/var/spool/virtual|${prefix}/var/${name}/spool|g" \
46                "${worksrcpath}/vm-pop3d.h"
47
48# Set vm-pop3d.h virtual directory domain password path
49        reinplace "s|/etc/virtual|${prefix}/etc/${name}|g" \
50                "${worksrcpath}/vm-pop3d.h"
51}
52
53post-destroot {
54# Create spool and passwd file paths for the virtual domains
55        xinstall -m 755 -d ${destroot}${prefix}/var/${name}/spool
56        xinstall -m 755 -d ${destroot}${prefix}/etc/${name}
57        system "chown postfix:postfix ${destroot}${prefix}/var/${name}/spool"
58
59# Create lock file path
60        xinstall -m 755 -d ${destroot}${prefix}/var/${name}/lock
61
62# Keep the empty virtual spool and passwd file paths
63destroot.keepdirs \
64        ${destroot}${prefix}/var/${name}/spool \
65        ${destroot}${prefix}/var/${name}/lock \
66        ${destroot}${prefix}/etc/${name}
67
68# Install documentation type stuff
69        xinstall -d ${destroot}${prefix}/share/doc/${name}
70        xinstall -m 644 ${worksrcpath}/AUTHORS ${destroot}${prefix}/share/doc/${name}
71        xinstall -m 644 ${worksrcpath}/CHANGES ${destroot}${prefix}/share/doc/${name}
72        xinstall -m 644 ${worksrcpath}/COPYING ${destroot}${prefix}/share/doc/${name}
73        xinstall -m 644 ${worksrcpath}/FAQ ${destroot}${prefix}/share/doc/${name}
74        xinstall -m 644 ${worksrcpath}/INSTALL ${destroot}${prefix}/share/doc/${name}
75        xinstall -m 644 ${worksrcpath}/README ${destroot}${prefix}/share/doc/${name}
76        xinstall -m 644 ${worksrcpath}/TODO ${destroot}${prefix}/share/doc/${name}
77
78# Fix and copy the init script
79        reinplace "s|daemon vm-pop3d|${prefix}/sbin/vm-pop3d --user postfix --group postfix|g" \
80                "${worksrcpath}/vm-pop3d.init"
81
82        reinplace "s|/usr/local/sbin|${prefix}/sbin|g" \
83                "${worksrcpath}/vm-pop3d.init"
84
85        reinplace "s|/var/lock/subsys|${prefix}/var/${name}/lock|g" \
86                "${worksrcpath}/vm-pop3d.init"
87
88        reinplace "s|killproc|killall|g" \
89                "${worksrcpath}/vm-pop3d.init"
90
91        reinplace "s|/etc/rc.d/init.d/functions|/etc/rc.common|g" \
92                "${worksrcpath}/vm-pop3d.init"
93
94        xinstall -d -m 755  ${destroot}${prefix}/share/${name}
95       
96        xinstall -m 755 ${worksrcpath}/vm-pop3d.init ${destroot}${prefix}/share/${name}
97}
98
99post-activate {
100
101ui_msg "\n#### To setup vm-pop3d with Postfix ####
102
103Notice: The paths to files used by vm-pop3d are hard coded at compile time so
104         if you deviate from the paths described below vm-pop3d will not work.
105
1061) Setup Postfix (if first-time setup) and create spool directories
107   for your vm-pop3d virtual domains.
108
109        cd ${prefix}/etc/postfix
110        sudo cp master.cf.sample master.cf
111        sudo cp main.cf.sample main.cf
112 
113        sudo mkdir ${prefix}/var/${name}/spool/my-vdomain1.com
114        sudo chown postfix:postfix ${prefix}/var/${name}/spool/my-vdomain1.com
115        sudo chmod 775 ${prefix}/var/${name}/spool/my-vdomain1.com
116
117
1182) Configure Postfix for virtual mailboxes
119
120   Add to main.cf
121
122        virtual_mailbox_base = ${prefix}/var/${name}/spool
123        virtual_mailbox_maps = hash:${prefix}/etc/${name}/vmailbox_maps
124        virtual_mailbox_domains = hash:${prefix}/etc/${name}/vdomain_maps
125        virtual_uid_maps = static:<postfix user's uid>
126        virtual_gid_maps = static:<postfix user's gid>
127        virtual_mailbox_lock = dotlock
128        virtual_minimum_uid = <postfix user's uid>
129
130   NOTE: Do NOT include the virtual domain name in main.cf's \$mydestination
131         or Postfix will reject mail to this domain since local (Unix) accounts
132         for virtual domains do not exist.
133
134
1353) Create virtual mailbox lookup tables
136
137        sudo touch ${prefix}/etc/${name}/vdomain_maps (contents below)
138
139   my-vdomain1.com     placeholder (any text)
140   my-vdomain2.com     placeholder
141
142        sudo touch ${prefix}/etc/vm-pop3d/vmailbox_maps (contents below)
143
144   user1@my-vdomain1.com         my-vdomain1.com/user1
145   user2@my-vdomain1.com         my-vdomain1.com/user2
146
147        sudo postmap ${prefix}/etc/${name}/vdomain_maps (make .db hash files)
148        sudo postmap ${prefix}/etc/${name}/vmailbox_maps
149
150
1514) Restart Postfix and test SMTP message delivery to virtual domains
152
153        sudo postfix reload
154
155   Now send an email to an account in a virtual domain; look here to see if
156   messages are arriving:
157
158        ls ${prefix}/var/${name}/spool/my-vdomainx.com for messages.
159
160   Check the error logs for either delivery errors or (after next step)
161   POP errors:
162
163        tail /var/log/mail.log
164
165
1665) Create virtual domain passwd files, substituting real domain names for my-vdomain
167
168        cd ${prefix}/etc/${name}
169        sudo mkdir my-vdomain1.com
170        cd my-vdomain1.com
171        sudo htpasswd -c passwd user1 (-c creates the file 'passwd' to hold the 1st vdomain1 user)
172        sudo htpasswd passwd user2 (don't need -c for subsequent users of the vdomain1)
173
174
1756) Start vm-pop3d (and set it to launch at startup) and test POP access to virtual domains with telnet
176
177        sudo launchctl load -w /Library/LaunchDaemons/org.darwinports.vm-pop3d.plist
178
179        telnet localhost 110  (response ->)  +OK POP3 Welcome to vm-pop3d 1.x.x
180        USER <user@domain>
181        PASS <password>
182        LIST (to see messages)
183        RETR 1 (to view message #1)
184
185   Documentation is in ${prefix}/share/doc/${name}\n"
186}
Note: See TracBrowser for help on using the repository browser.