1 |
wellsi |
1.1 |
diff -ruN e-smith-imap-2.2.0.old/createlinks e-smith-imap-2.2.0/createlinks |
2 |
|
|
--- e-smith-imap-2.2.0.old/createlinks 2008-10-07 10:35:56.000000000 -0700 |
3 |
|
|
+++ e-smith-imap-2.2.0/createlinks 2013-02-21 19:31:09.000000000 -0800 |
4 |
|
|
@@ -36,11 +36,6 @@ |
5 |
|
|
"root/etc/e-smith/events/$event/services2adjust/imaps"); |
6 |
|
|
} |
7 |
|
|
|
8 |
|
|
-foreach my $event (qw(post-upgrade)) |
9 |
|
|
-{ |
10 |
|
|
- event_link("imap-relocate-maildirs", $event, "05"); |
11 |
|
|
-} |
12 |
|
|
- |
13 |
|
|
safe_symlink("daemontools", "root/etc/rc.d/init.d/imap"); |
14 |
|
|
service_link_enhanced("imap", "S55", "7"); |
15 |
|
|
service_link_enhanced("imap", "K45", "6"); |
16 |
|
|
diff -ruN e-smith-imap-2.2.0.old/root/etc/e-smith/events/actions/imap-relocate-maildirs e-smith-imap-2.2.0/root/etc/e-smith/events/actions/imap-relocate-maildirs |
17 |
|
|
--- e-smith-imap-2.2.0.old/root/etc/e-smith/events/actions/imap-relocate-maildirs 2008-10-07 10:35:56.000000000 -0700 |
18 |
|
|
+++ e-smith-imap-2.2.0/root/etc/e-smith/events/actions/imap-relocate-maildirs 1969-12-31 16:00:00.000000000 -0800 |
19 |
|
|
@@ -1,165 +0,0 @@ |
20 |
|
|
-#!/usr/bin/perl -w |
21 |
|
|
- |
22 |
|
|
-#---------------------------------------------------------------------- |
23 |
|
|
-# copyright (C) 1999-2005 Mitel Networks Corporation |
24 |
|
|
-# |
25 |
|
|
-# This program is free software; you can redistribute it and/or modify |
26 |
|
|
-# it under the terms of the GNU General Public License as published by |
27 |
|
|
-# the Free Software Foundation; either version 2 of the License, or |
28 |
|
|
-# (at your option) any later version. |
29 |
|
|
-# |
30 |
|
|
-# This program is distributed in the hope that it will be useful, |
31 |
|
|
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
32 |
|
|
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
33 |
|
|
-# GNU General Public License for more details. |
34 |
|
|
-# |
35 |
|
|
-# You should have received a copy of the GNU General Public License |
36 |
|
|
-# along with this program; if not, write to the Free Software |
37 |
|
|
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
38 |
|
|
-# |
39 |
|
|
-# Technical support for this program is available from Mitel Networks |
40 |
|
|
-# Please visit our web site www.mitel.com/sme/ for details. |
41 |
|
|
-#---------------------------------------------------------------------- |
42 |
|
|
-use strict; |
43 |
|
|
- |
44 |
|
|
-use esmith::AccountsDB; |
45 |
|
|
-use User::pwent; |
46 |
|
|
-use File::Find; |
47 |
|
|
-use File::Glob; |
48 |
|
|
- |
49 |
|
|
-my $event = $ARGV[0] || 'Unknown'; |
50 |
|
|
- |
51 |
|
|
-my $adb = esmith::AccountsDB->open; |
52 |
|
|
- |
53 |
|
|
-die "Couldn't open AccountsDB\n" unless $adb; |
54 |
|
|
- |
55 |
|
|
-my @users = ('admin', map { $_->key } $adb->users); |
56 |
|
|
- |
57 |
|
|
-foreach my $user ( @users ) |
58 |
|
|
-{ |
59 |
|
|
- my $pwent = getpwnam($user) |
60 |
|
|
- or die "Couldn't get password entry for $user\n"; |
61 |
|
|
- |
62 |
|
|
- chdir $pwent->dir or die "Couldn't chdir $pwent->dir:$!\n"; |
63 |
|
|
- |
64 |
|
|
- %::maildirs = (); |
65 |
|
|
- # Go and find maildirs we wish to relocate |
66 |
|
|
- find({ wanted => \&wanted, no_chdir => 1 }, '.'); |
67 |
|
|
- |
68 |
|
|
- # We do a reverse sort here so that we are doing a depth first |
69 |
|
|
- # move of directories |
70 |
|
|
- foreach my $here (reverse sort keys %::maildirs) |
71 |
|
|
- { |
72 |
|
|
- my $there = $::maildirs{$here}; |
73 |
|
|
- if (-e "$there") |
74 |
|
|
- { |
75 |
|
|
- $there .= "-" . time if (-e "$there"); |
76 |
|
|
- if (-e "$there") |
77 |
|
|
- { |
78 |
|
|
- warn "Conflict for $user: Can't determine new name for $here\n"; |
79 |
|
|
- next; |
80 |
|
|
- } |
81 |
|
|
- } |
82 |
|
|
- warn "Moving $here to $there\n"; |
83 |
|
|
- rename $here, $there |
84 |
|
|
- or warn("Could not rename $here to $there: $!\n"); |
85 |
|
|
- } |
86 |
|
|
- |
87 |
|
|
- # Now make sure that we have a junkmail mailbox |
88 |
|
|
- my $prefix = "Maildir/.junkmail"; |
89 |
|
|
- unless (-d "$prefix" && |
90 |
|
|
- -d "$prefix/tmp" && |
91 |
|
|
- -d "$prefix/new" && |
92 |
|
|
- -d "$prefix/cur") |
93 |
|
|
- { |
94 |
|
|
- # We'd better make them then ... |
95 |
|
|
- my $pid = fork; |
96 |
|
|
- die "Could not fork in $ARGV[0]" unless defined $pid; |
97 |
|
|
- if ($pid) |
98 |
|
|
- { |
99 |
|
|
- waitpid($pid, 0); |
100 |
|
|
- } |
101 |
|
|
- else |
102 |
|
|
- { |
103 |
|
|
- $) = $pwent->gid; |
104 |
|
|
- $> = $pwent->uid; |
105 |
|
|
- umask 077; |
106 |
|
|
- foreach my $suffix ("", qw(/tmp /cur /new)) |
107 |
|
|
- { |
108 |
|
|
- my $dir = "$prefix$suffix"; |
109 |
|
|
- unless (-d "$dir") |
110 |
|
|
- { |
111 |
|
|
- mkdir("$dir", 0700) or warn("Error creating $dir: $!\n"); |
112 |
|
|
- } |
113 |
|
|
- } |
114 |
|
|
- exit 0; |
115 |
|
|
- # NOTREACHED |
116 |
|
|
- } |
117 |
|
|
- } |
118 |
|
|
- if (-f ".mailboxlist" || -f "Maildir/.subscriptions") |
119 |
|
|
- { |
120 |
|
|
- my $pid = fork; |
121 |
|
|
- die "Could not fork in $ARGV[0]" unless defined $pid; |
122 |
|
|
- if ($pid) |
123 |
|
|
- { |
124 |
|
|
- waitpid($pid, 0); |
125 |
|
|
- } |
126 |
|
|
- else |
127 |
|
|
- { |
128 |
|
|
- $) = $pwent->gid; |
129 |
|
|
- $> = $pwent->uid; |
130 |
|
|
- umask 077; |
131 |
|
|
- if (-f ".mailboxlist") |
132 |
|
|
- { |
133 |
|
|
- open (OSUBS, "<.mailboxlist") or |
134 |
|
|
- die "Could not open mailboxlist file: $!\n"; |
135 |
|
|
- } |
136 |
|
|
- else |
137 |
|
|
- { |
138 |
|
|
- open (OSUBS, "<Maildir/.subscriptions") or |
139 |
|
|
- die "Could not open mailboxlist file: $!\n"; |
140 |
|
|
- } |
141 |
|
|
- my @subs = <OSUBS>; |
142 |
|
|
- close OSUBS; |
143 |
|
|
- open (NSUBS, ">Maildir/.subscriptions") or |
144 |
|
|
- die "Could not open subscriptions file: $!\n"; |
145 |
|
|
- foreach (@subs) |
146 |
|
|
- { |
147 |
|
|
- s/^Mail\///; |
148 |
|
|
- s/[\/;]/./g; |
149 |
|
|
- s{^~/}{}g; |
150 |
|
|
- print NSUBS; |
151 |
|
|
- } |
152 |
|
|
- close NSUBS; |
153 |
|
|
- unlink ".mailboxlist"; |
154 |
|
|
- exit 0; |
155 |
|
|
- # NOTREACHED |
156 |
|
|
- } |
157 |
|
|
- } |
158 |
|
|
-} |
159 |
|
|
- |
160 |
|
|
- |
161 |
|
|
-sub wanted |
162 |
|
|
-{ |
163 |
|
|
- my $here = $_; |
164 |
|
|
- # Don't follow symlinks or descend into ./files |
165 |
|
|
- if (-l $here || $here eq "./files") |
166 |
|
|
- { |
167 |
|
|
- #print "Pruning at $here\n"; |
168 |
|
|
- $File::Find::prune = 1; |
169 |
|
|
- return; |
170 |
|
|
- } |
171 |
|
|
- return if ($here eq "./Maildir"); |
172 |
|
|
- |
173 |
|
|
- # We only care about directories, and they must be maildirs |
174 |
|
|
- return unless (-d $here && -d "$here/cur" && -d "$here/tmp" && -d "$here/new"); |
175 |
|
|
- |
176 |
|
|
- # We won't touch anything which already looks correct |
177 |
|
|
- return if ($here =~ m:^\./Maildir/\.:o); |
178 |
|
|
- |
179 |
|
|
- my $there = $here; |
180 |
|
|
- $there =~ s:^\./::; |
181 |
|
|
- $there =~ s:^Mail(/|dir/;)::o; |
182 |
|
|
- $there =~ s:[/;]:.:og; |
183 |
|
|
- $::maildirs{$here} = "./Maildir/.$there"; |
184 |
|
|
-} |