[c5c522c] | 1 | #!/bin/sh |
---|
| 2 | # |
---|
| 3 | # Copyright (c) 2000 Carnegie Mellon University. All rights reserved. |
---|
| 4 | # |
---|
| 5 | # Redistribution and use in source and binary forms, with or without |
---|
| 6 | # modification, are permitted provided that the following conditions |
---|
| 7 | # are met: |
---|
| 8 | # |
---|
| 9 | # 1. Redistributions of source code must retain the above copyright |
---|
| 10 | # notice, this list of conditions and the following disclaimer. |
---|
| 11 | # |
---|
| 12 | # 2. Redistributions in binary form must reproduce the above copyright |
---|
| 13 | # notice, this list of conditions and the following disclaimer in |
---|
| 14 | # the documentation and/or other materials provided with the |
---|
| 15 | # distribution. |
---|
| 16 | # |
---|
| 17 | # 3. The name "Carnegie Mellon University" must not be used to |
---|
| 18 | # endorse or promote products derived from this software without |
---|
| 19 | # prior written permission. For permission or any other legal |
---|
| 20 | # details, please contact |
---|
| 21 | # Office of Technology Transfer |
---|
| 22 | # Carnegie Mellon University |
---|
| 23 | # 5000 Forbes Avenue |
---|
| 24 | # Pittsburgh, PA 15213-3890 |
---|
| 25 | # (412) 268-4387, fax: (412) 268-7395 |
---|
| 26 | # tech-transfer@andrew.cmu.edu |
---|
| 27 | # |
---|
| 28 | # 4. Redistributions of any form whatsoever must retain the following |
---|
| 29 | # acknowledgment: |
---|
| 30 | # "This product includes software developed by Computing Services |
---|
| 31 | # at Carnegie Mellon University (http://www.cmu.edu/computing/)." |
---|
| 32 | # |
---|
| 33 | # CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO |
---|
| 34 | # THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
---|
| 35 | # AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE |
---|
| 36 | # FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
---|
| 37 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN |
---|
| 38 | # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING |
---|
| 39 | # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
---|
| 40 | # |
---|
| 41 | exec perl -x -S $0 ${1+"$@"} # -*-perl-*- |
---|
| 42 | #!perl -w |
---|
| 43 | |
---|
| 44 | if ($] !~ /^5\..*/) { |
---|
| 45 | # uh-oh. this isn't perl 5. |
---|
| 46 | foreach (split(/:/, $ENV{PATH})) { # try to find "perl5". |
---|
| 47 | exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5"); |
---|
| 48 | } |
---|
| 49 | # we failed. bail. |
---|
| 50 | die "Your perl is too old; I need perl 5.\n"; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | # load the real script. this is isolated in an 'eval' so perl4 won't |
---|
| 54 | # choke on the perl5-isms. |
---|
| 55 | eval join("\n", <DATA>); |
---|
| 56 | if ($@) { die "$@"; } |
---|
| 57 | |
---|
| 58 | __END__ |
---|
| 59 | require 5; |
---|
| 60 | |
---|
| 61 | $imapdconf = shift || "/etc/imapd.conf"; |
---|
| 62 | |
---|
| 63 | open CONF, $imapdconf or die "can't open $imapdconf"; |
---|
| 64 | print "reading configure file...\n"; |
---|
| 65 | while (<CONF>) { |
---|
| 66 | if (/^#/) { |
---|
| 67 | next; |
---|
| 68 | } |
---|
| 69 | if (/^configdirectory:\s+(.*)$/) { |
---|
| 70 | $conf = $1; |
---|
| 71 | print "i will configure directory $conf.\n"; |
---|
| 72 | } |
---|
| 73 | if (/^partition-.*:\s+(.*)$/) { |
---|
| 74 | if (grep /$1/, @parts) { |
---|
| 75 | next; |
---|
| 76 | } |
---|
| 77 | print "i saw partition $1.\n"; |
---|
| 78 | push @parts, $1; |
---|
| 79 | } |
---|
| 80 | } |
---|
| 81 | print "done\n"; |
---|
| 82 | close CONF; |
---|
| 83 | |
---|
| 84 | $d = $conf; |
---|
| 85 | |
---|
| 86 | print "configuring $d...\n"; |
---|
| 87 | |
---|
| 88 | chdir $d or die "couldn't change to $d"; |
---|
| 89 | |
---|
| 90 | mkdir "proc", 0755; |
---|
| 91 | mkdir "db", 0755; |
---|
| 92 | mkdir "socket", 0755; |
---|
| 93 | mkdir "log", 0755; |
---|
| 94 | mkdir "msg", 0755; |
---|
| 95 | mkdir "ptclient", 0755; |
---|
| 96 | |
---|
| 97 | while ($part = shift @parts) { |
---|
| 98 | print "creating $part...\n"; |
---|
| 99 | mkdir $part, 0755; |
---|
| 100 | chdir $part or die "couldn't change to partition $part"; |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | print "done\n"; |
---|