wilde: utils/admin kolab-mailboxinfo.pl,1.1,1.2

cvs at kolab.org cvs at kolab.org
Wed Jan 30 15:50:02 CET 2008


Author: wilde

Update of /kolabrepository/utils/admin
In directory doto:/tmp/cvs-serv20938

Modified Files:
	kolab-mailboxinfo.pl 
Log Message:
Added a option `-c' (output cyradm commands) to kolab-mailboxinfo.
With this option the output of kolab-mailboxinfo.pl can be used as
input to cyradm to restore acls and annotations.


Index: kolab-mailboxinfo.pl
===================================================================
RCS file: /kolabrepository/utils/admin/kolab-mailboxinfo.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- kolab-mailboxinfo.pl	22 Jun 2007 15:37:00 -0000	1.1
+++ kolab-mailboxinfo.pl	30 Jan 2008 14:50:00 -0000	1.2
@@ -14,10 +14,14 @@
 # $Id$
 
 use Kolab::Cyrus;
+use Getopt::Std;
 
 my $cyrus = Kolab::Cyrus::create;
 $cyrus || die 'Unable to login to Cyrus IMAP server\n';
 
+# -c generates output suitable as input to cyradm
+Getopt::Std::getopts('c');
+
 my @results = $cyrus->listmailbox('*');
 sort(@results);
 foreach my $result (@results) {
@@ -25,7 +29,11 @@
 
     my %rights = $cyrus->listacl(${mailbox});
     foreach my $user (sort keys %rights) {
-        print "${mailbox}: acl $user: $rights{$user}\n";
+        if($opt_c == 1) {
+            print "sam ${mailbox} $user $rights{$user}\n";
+        } else {
+            print "${mailbox}: acl $user: $rights{$user}\n";
+        }
     }
 
     my %info = $cyrus->getinfo(${mailbox});
@@ -33,7 +41,11 @@
         $attrib = $key;
         $attrib =~ s/^[^}]*}//;
         if(not $attrib =~ /^\/vendor\/cmu\//) {
-            print "${mailbox}: annotation $attrib: $info{$key}\n";
+            if($opt_c == 1) {
+                print "mboxcfg ${mailbox} $attrib $info{$key}\n";
+            } else {
+                print "${mailbox}: annotation $attrib: $info{$key}\n";
+            }
         }
     }
 }





More information about the commits mailing list