ispman/scripts fixldif.pl,1.1.1.1,1.2 getvar.pl,1.2,1.3 ldif2ldap,1.8,1.9 ldifschema2db.pl,1.2,1.3 ldifschema2hash.pl,1.2,1.3 ldifupdate,1.10,1.11 make.pl,1.20,1.21 schema2ldif.pl,1.2,1.3 subs.pl,1.2,1.3 upgrade_from_ldif.pl,1.4,1.5 v2tov3.pl,1.9,1.10

Joerg Delker <[email protected]>
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30799/scripts

Modified Files:
	fixldif.pl getvar.pl ldif2ldap ldifschema2db.pl 
	ldifschema2hash.pl ldifupdate make.pl schema2ldif.pl subs.pl 
	upgrade_from_ldif.pl v2tov3.pl 
Log Message:
code reformatting by perltidy conforming perl style guide


Index: fixldif.pl
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/fixldif.pl,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- fixldif.pl	31 Dec 2000 01:52:42 -0000	1.1.1.1
+++ fixldif.pl	30 May 2004 23:35:39 -0000	1.2
@@ -1,14 +1,14 @@
 #!/usr/bin/perl
-while (<>){
-	chomp; #remove the line break
-	s/\s+$//g; #remove any leading spaces.
-	$f.="$_\n"; #put the line break back
+while (<>) {
+    chomp;        #remove the line break
+    s/\s+$//g;    #remove any leading spaces.
+    $f .= "$_\n"; #put the line break back
 }
 
 #remove extra lines else the ldif will not work.
-$f=~s/dn:/\ndn:/g;
-$f=~s/\n\n\n+?dn/\n\ndn/g;
-$f=~s/^\n//g;
+$f =~ s/dn:/\ndn:/g;
+$f =~ s/\n\n\n+?dn/\n\ndn/g;
+$f =~ s/^\n//g;
 chomp($f);
 print $f;
 

Index: ldifschema2hash.pl
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/ldifschema2hash.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ldifschema2hash.pl	4 May 2002 23:24:06 -0000	1.2
+++ ldifschema2hash.pl	30 May 2004 23:35:39 -0000	1.3
@@ -4,39 +4,32 @@
 use Net::LDAP::Schema;
 $schema = Net::LDAP::Schema->new;
 
-
-
 $schema->parse( $ARGV[0] ) or die $schema->error;
 @attributetypes = $schema->attributes();
 @objectclasses  = $schema->objectclasses();
 
-foreach $attr(@attributetypes,@objectclasses){
-        $_oid = $schema->name2oid( "$attr" );
-        if (ref $_oid ne "ARRAY") {
-           push @$_oid, $_oid;
-        }
+foreach $attr ( @attributetypes, @objectclasses ) {
+    $_oid = $schema->name2oid("$attr");
+    if ( ref $_oid ne "ARRAY" ) {
+        push @$_oid, $_oid;
+    }
 
-        foreach $oid(@$_oid){
-           @at_items = $schema->items( "$oid" );
-           foreach $value ( @at_items ){
-              @item = $schema->item( $oid, $value );
+    foreach $oid (@$_oid) {
+        @at_items = $schema->items("$oid");
+        foreach $value (@at_items) {
+            @item = $schema->item( $oid, $value );
 
-               if ( defined(@item) && $#item >= 0 ){
-                  for (@item) {
-                     $attributetypeshashref->{$attr}{$value}=$item[0];
-                  
-                  }
-               }
+            if ( defined(@item) && $#item >= 0 ) {
+                for (@item) {
+                    $attributetypeshashref->{$attr}{$value} = $item[0];
+
+                }
             }
         }
+    }
 }
 
-   
-   
-   
-   
 #$Data::Dumper::Terse = 0;          # don't output names where feasible
 #$Data::Dumper::Indent = 7;
 #print Dumper($attributetypeshashref);
 
-

Index: upgrade_from_ldif.pl
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/upgrade_from_ldif.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- upgrade_from_ldif.pl	4 May 2002 23:16:52 -0000	1.4
+++ upgrade_from_ldif.pl	30 May 2004 23:35:39 -0000	1.5
@@ -1,28 +1,29 @@
 #!/usr/bin/perl
-die print "\nUsage: $0 ldif-file\nOh and the file must exists too.\n\nTip: You can create this file by running\nmake ispman\n\n" unless (-e $ARGV[0]);
+die print
+"\nUsage: $0 ldif-file\nOh and the file must exists too.\n\nTip: You can create this file by running\nmake ispman\n\n"
+  unless ( -e $ARGV[0] );
 
[email protected]=split("/", $0);
[email protected] = split( "/", $0 );
 pop @path;
-$home=join "/", @path, "../";
-
-
-
+$home = join "/", @path, "../";
 
-$ldif=$ARGV[0];
+$ldif = $ARGV[0];
 
-if (-e "$home/tmp/vars.pl" ) {
-   require "$home/tmp/vars.pl";
-} else {
-   print "Cant find tmp/vars.pl. Make sure that it is in your current directory";
+if ( -e "$home/tmp/vars.pl" ) {
+    require "$home/tmp/vars.pl";
+}
+else {
+    print
+      "Cant find tmp/vars.pl. Make sure that it is in your current directory";
 }
 
+$command =
+"$home/scripts/subs.pl $ldif | $home/scripts/fixldif.pl | ldapadd -x -c  -h $VAR1->{ldapHost}{default} -D \"$VAR1->{ldapRootDN}{default}\" -w $VAR1->{ldapRootPass}{default} ";
 
-$command="$home/scripts/subs.pl $ldif | $home/scripts/fixldif.pl | ldapadd -x -c  -h $VAR1->{ldapHost}{default} -D \"$VAR1->{ldapRootDN}{default}\" -w $VAR1->{ldapRootPass}{default} ";
 #print "Here is the command that you need to run. I wont run it for you.\nExamine it and run it your self.\n\n$command\n";
 print "Running $command\n";
 system($command);
 
-
 exit;
 __END__
 

Index: ldifschema2db.pl
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/ldifschema2db.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ldifschema2db.pl	4 May 2002 23:24:06 -0000	1.2
+++ ldifschema2db.pl	30 May 2004 23:35:39 -0000	1.3
@@ -4,38 +4,32 @@
 use Net::LDAP::Schema;
 $schema = Net::LDAP::Schema->new;
 
-
-
 $schema->parse( $ARGV[0] ) or die $schema->error;
 @attributetypes = $schema->attributes();
 @objectclasses  = $schema->objectclasses();
 
-foreach $attr(@attributetypes,@objectclasses){
-        $_oid = $schema->name2oid( "$attr" );
-        if (ref $_oid ne "ARRAY") {
-           push @$_oid, $_oid;
-        }
+foreach $attr ( @attributetypes, @objectclasses ) {
+    $_oid = $schema->name2oid("$attr");
+    if ( ref $_oid ne "ARRAY" ) {
+        push @$_oid, $_oid;
+    }
 
-        foreach $oid(@$_oid){
-           @at_items = $schema->items( "$oid" );
-           foreach $value ( @at_items ){
-              @item = $schema->item( $oid, $value );
+    foreach $oid (@$_oid) {
+        @at_items = $schema->items("$oid");
+        foreach $value (@at_items) {
+            @item = $schema->item( $oid, $value );
 
-               if ( defined(@item) && $#item >= 0 ){
-                  for (@item) {
-                     $attributetypeshashref->{$attr}{$value}=$item[0];
-                  
-                  }
-               }
+            if ( defined(@item) && $#item >= 0 ) {
+                for (@item) {
+                    $attributetypeshashref->{$attr}{$value} = $item[0];
+
+                }
             }
         }
+    }
 }
 
-   
-   
-   
-   
-$Data::Dumper::Terse = 0;          # don't output names where feasible
+$Data::Dumper::Terse  = 0;    # don't output names where feasible
 $Data::Dumper::Indent = 7;
 print Dumper($attributetypeshashref);
 

Index: ldifupdate
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/ldifupdate,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ldifupdate	27 Apr 2004 20:10:41 -0000	1.10
+++ ldifupdate	30 May 2004 23:35:39 -0000	1.11
@@ -16,403 +16,433 @@
 use Net::LDAP::Entry;
 
 # defines
-my @oc_normalDomain = qw(ispmanDomain PureFTPdUser posixAccount);
-my @oc_replicaDomain = qw(ispmanDomain ispmanBranch top);
-my @oc_virtualHost = qw(ispmanVirtualHost posixAccount PureFTPdUser);
+my @oc_normalDomain       = qw(ispmanDomain PureFTPdUser posixAccount);
+my @oc_replicaDomain      = qw(ispmanDomain ispmanBranch top);
+my @oc_virtualHost        = qw(ispmanVirtualHost posixAccount PureFTPdUser);
 my $default_domainHomedir = "/ispman/domains";
-my @default_fileserver = qw( );
-my @default_webhost = qw( );
-my $default_loginShell = "/bin/false";
-my $default_vhostShell = "/bin/false";
-my $dummyUid = "999999";
-my $dummyGid = "999999";
-my $dummyPassword = "123456";
-
+my @default_fileserver    = qw( );
+my @default_webhost       = qw( );
+my $default_loginShell    = "/bin/false";
+my $default_vhostShell    = "/bin/false";
+my $dummyUid              = "999999";
+my $dummyGid              = "999999";
+my $dummyPassword         = "123456";
 
 # private variables
-my ($ldif_in, $ldif_out, $entry, $basedn);
-my (%opts, $dn, $msg, $chng, $mode);
-
-
+my ( $ldif_in, $ldif_out, $entry, $basedn );
+my ( %opts,    $dn,       $msg,   $chng, $mode );
 
 sub usage {
     print "ISPMan ldifupdate\n";
-    print "A utility to update your ispman LDAP data according to current ISPMan schema.\n";
-    print "It will convert the given input LDIF and output it to an output LDIF\n";
+    print
+"A utility to update your ispman LDAP data according to current ISPMan schema.\n";
+    print
+      "It will convert the given input LDIF and output it to an output LDIF\n";
     print "either in add or modify format.\n\n";
     print "Syntax: ldifupdate <options>\n";
     print "Options:\n";
-    print "  -i <file>        input LDIF filename\n"; 
-    print "  -o <file>        output LDIF filename\n"; 
-    print "  -b <basedn>      base DN (optional), which limits changes to this subtree\n"; 
+    print "  -i <file>        input LDIF filename\n";
+    print "  -o <file>        output LDIF filename\n";
+    print
+"  -b <basedn>      base DN (optional), which limits changes to this subtree\n";
     print "  -m <add/modify>  type of LDIF to create (default=add)\n";
 }
 
 sub ldif_action {
-    my ($cmd,$attr,$attrval)=@_;
+    my ( $cmd, $attr, $attrval ) = @_;
     my $ldif;
 
     # modify entry
-    if ($cmd eq "delete"){
-	$entry->delete($attr => [$attrval]);
-    } else {
-	$entry->$cmd($attr,$attrval);
+    if ( $cmd eq "delete" ) {
+        $entry->delete( $attr => [$attrval] );
+    }
+    else {
+        $entry->$cmd( $attr, $attrval );
     }
 
     # generate ldif change
-    $ldif="$cmd: $attr\n";
-    if (ref $attrval eq "ARRAY"){
-	for (@$attrval){ $ldif.="$attr: $_\n"; }
-    } else {
-	$ldif.="$attr: $attrval\n";
+    $ldif = "$cmd: $attr\n";
+    if ( ref $attrval eq "ARRAY" ) {
+        for (@$attrval) { $ldif .= "$attr: $_\n"; }
+    }
+    else {
+        $ldif .= "$attr: $attrval\n";
     }
 
-    $ldif.="-\n";
+    $ldif .= "-\n";
 
     # write ldif change to global var
-    $chng.=$ldif;
+    $chng .= $ldif;
 }
 
-    
 sub update_oc {
-    my ($entry,$src, $dst)=@_;
-    my $msg="";
+    my ( $entry, $src, $dst ) = @_;
+    my $msg = "";
     my %in_src;
     my %in_dst;
-    
-    for (@$src) { $in_src{$_}=1; }
+
+    for (@$src) { $in_src{$_} = 1; }
     for (@$dst) {
-	if (! $in_src{$_}) {
-	    $msg.="adding objectclass: \"$_\"\n";
-	    ldif_action("add","objectclass",$_);
-	}
-	$in_dst{$_}=1;
+        if ( !$in_src{$_} ) {
+            $msg .= "adding objectclass: \"$_\"\n";
+            ldif_action( "add", "objectclass", $_ );
+        }
+        $in_dst{$_} = 1;
     }
     for (@$src) {
-	if (! $in_dst{$_}) {
-	    $msg.="deleting objectclass: \"$_\"\n";
-	    ldif_action("delete","objectclass",$_);
-	}
+        if ( !$in_dst{$_} ) {
+            $msg .= "deleting objectclass: \"$_\"\n";
+            ldif_action( "delete", "objectclass", $_ );
+        }
     }
-    
+
     return $msg;
 }
 
-
 ## main
 
-
 # get parameters
-getopt('iobm',  \%opts);
-unless ($opts{'i'} or $opts{'o'}){
+getopt( 'iobm', \%opts );
+unless ( $opts{'i'} or $opts{'o'} ) {
     usage();
     exit 1;
 }
 
 # set mode
-$mode=$opts{'m'} || "add";
+$mode = $opts{'m'} || "add";
 
-if ($mode ne "add" and $mode ne "modify"){
+if ( $mode ne "add" and $mode ne "modify" ) {
     print STDERR "unknown mode: $mode\n";
     usage();
     exit 1;
 }
 
-
 # input file
-$ldif_in= Net::LDAP::LDIF->new( $opts{'i'});
+$ldif_in = Net::LDAP::LDIF->new( $opts{'i'} );
 
 # output file
-if ($mode eq "add"){
-    $ldif_out = Net::LDAP::LDIF->new( $opts{'o'}, "w");
-} else {
-    open(OUTLDIF,">$opts{'o'}") || die "unable to create $opts{'o'}\n";
+if ( $mode eq "add" ) {
+    $ldif_out = Net::LDAP::LDIF->new( $opts{'o'}, "w" );
+}
+else {
+    open( OUTLDIF, ">$opts{'o'}" ) || die "unable to create $opts{'o'}\n";
 }
 
 # only work on entries of this basedn
 $basedn = $opts{'b'};
 
 # read and parse ldap data
-while( not $ldif_in->eof() ) {
-    undef ($entry);
+while ( not $ldif_in->eof() ) {
+    undef($entry);
     $entry = $ldif_in->read_entry();
-    
+
     # skip entry if we find an error
     if ( $ldif_in->error() ) {
-        print STDERR "Error msg: ",$ldif_in->error(),"\n";
-        print STDERR "Error lines:\n",$ldif_in->error_lines(),"\n";
+        print STDERR "Error msg: ",    $ldif_in->error(),       "\n";
+        print STDERR "Error lines:\n", $ldif_in->error_lines(), "\n";
     }
 
     $entry->changetype("add");
-    $dn=$entry->dn();
+    $dn = $entry->dn();
 
-    next unless ! defined($basedn) or $dn =~ m/$basedn$/;
+    next unless !defined($basedn) or $dn =~ m/$basedn$/;
 
-    $msg="";
-    $chng="";
+    $msg  = "";
+    $chng = "";
 
-    my @oc=$entry->get_value("objectclass");
+    my @oc = $entry->get_value("objectclass");
     my %oc;
-    for (@oc) { $oc{$_}=1 }
+    for (@oc) { $oc{$_} = 1 }
 
     ## work on entry
 
-    if ($#oc==0 && $oc[0] eq "top"){
-	
-	# if there is only one objectclass: top
-	# replace with ispmanBranch
-	$msg.="replacing objectclass: \"top\" -> \"ispmanBranch\"\n";
-	ldif_action("replace","objectclass","ispmanbranch");
+    if ( $#oc == 0 && $oc[0] eq "top" ) {
 
-    } elsif ($dn=~m/^ou=/ && $oc[0] ne "ispmanBranch"){
+        # if there is only one objectclass: top
+        # replace with ispmanBranch
+        $msg .= "replacing objectclass: \"top\" -> \"ispmanBranch\"\n";
+        ldif_action( "replace", "objectclass", "ispmanbranch" );
 
-	# if entry starts with "ou=" replace 
-       	# objectclasses top, organizationalunit with ispmanBranch
-	$msg.="replacing objectclass: -> \"ispmanBranch\"\n";
-	ldif_action("replace","objectclass","ispmanbranch");
+    }
+    elsif ( $dn =~ m/^ou=/ && $oc[0] ne "ispmanBranch" ) {
 
-    } elsif ($oc{"ispmanDomain"}){
-	
-	# update ispmanDomain objectclasses
-	if ($entry->get_value("ispmanDomainType") eq "replica") {
-	    $msg.=update_oc($entry,\@oc,\@oc_replicaDomain);
-	} else {
+        # if entry starts with "ou=" replace
+        # objectclasses top, organizationalunit with ispmanBranch
+        $msg .= "replacing objectclass: -> \"ispmanBranch\"\n";
+        ldif_action( "replace", "objectclass", "ispmanbranch" );
 
-	    ## normal domain
-	    $msg.=update_oc($entry,\@oc,\@oc_normalDomain);
+    }
+    elsif ( $oc{"ispmanDomain"} ) {
 
-	    # check ispmanDomainDefaultFileServer attribute
-	    if (! defined $entry->get_value("ispmanDomainDefaultFileServer")){
-		$msg.="WARNING! no \"Default Fileserver\" defined!\n";
-		if (@default_fileserver) {
-		    foreach (@default_fileserver){
-			$msg.="adding ispmanDomainDefaultFileServer: \"$_\"\n";
-			ldif_action("add","ispmanDomainDefaultFileServer",$_);
-		    }
-		} else {
-		    $msg.="Please adjust \@default_fileserver array to set them automatically\n";
-		}
-	    }
-	    
-	    # check ispmanDomainDefaultWebServer attribute
-	    if (! defined $entry->get_value("ispmanDomainDefaultWebHost")){
-		$msg.="WARNING! no \"Default Webhost\" defined!\n";
-		if (@default_webhost) {
-		    foreach (@default_webhost){
-			$msg.="adding ispmanDomainWebHost: \"$_\"\n";
-			ldif_action("add","ispmanDomainDefaultWebHost",$_);
-		    }
-		} else {
-		    $msg.="Please adjust \@default_webhost array to set them automatically\n";
-		}
-	    }
-	}
+        # update ispmanDomain objectclasses
+        if ( $entry->get_value("ispmanDomainType") eq "replica" ) {
+            $msg .= update_oc( $entry, \@oc, \@oc_replicaDomain );
+        }
+        else {
 
-    } elsif ($oc{'ispmanVirtualHost'}){
+            ## normal domain
+            $msg .= update_oc( $entry, \@oc, \@oc_normalDomain );
 
-	# update ispmanVhost
-	my $ispmanDomain=$entry->get_value("ispmanDomain") || die("ispmanDomain undefined!");
-    	my $ispmanVhostName=$entry->get_value("ispmanVhostName") || die("ispmanVhostName undefined!");
+            # check ispmanDomainDefaultFileServer attribute
+            if ( !defined $entry->get_value("ispmanDomainDefaultFileServer") ) {
+                $msg .= "WARNING! no \"Default Fileserver\" defined!\n";
+                if (@default_fileserver) {
+                    foreach (@default_fileserver) {
+                        $msg .=
+                          "adding ispmanDomainDefaultFileServer: \"$_\"\n";
+                        ldif_action( "add", "ispmanDomainDefaultFileServer",
+                            $_ );
+                    }
+                }
+                else {
+                    $msg .=
+"Please adjust \@default_fileserver array to set them automatically\n";
+                }
+            }
 
-	# checking/replacing vhost objectclasses
-	$msg.=update_oc($entry,\@oc,\@oc_virtualHost);
+            # check ispmanDomainDefaultWebServer attribute
+            if ( !defined $entry->get_value("ispmanDomainDefaultWebHost") ) {
+                $msg .= "WARNING! no \"Default Webhost\" defined!\n";
+                if (@default_webhost) {
+                    foreach (@default_webhost) {
+                        $msg .= "adding ispmanDomainWebHost: \"$_\"\n";
+                        ldif_action( "add", "ispmanDomainDefaultWebHost", $_ );
+                    }
+                }
+                else {
+                    $msg .=
+"Please adjust \@default_webhost array to set them automatically\n";
+                }
+            }
+        }
 
-	# checking vhost cn attribute
-	my $lcn=$entry->get_value("cn");
-	my $cn=join ".", ($ispmanVhostName, $ispmanDomain);
-	if (! defined $lcn){
-	    $msg.="adding cn with \"$cn\"\n";
-	    ldif_action("add","cn",$cn);
-	} elsif ($lcn ne $cn) {
-	    $msg.="changing cn: \"$lcn\" -> \"$cn\"\n";
-	    ldif_action("replace","cn",$cn);
-	}
-	
-	# checking vhost uid attribute
-	my $luid=$entry->get_value("uid");
-	my $uid=join ".", ($ispmanVhostName, $ispmanDomain);
-	if (! defined $luid){
-	    $msg.="adding uid with \"$uid\"\n";
-	    ldif_action("add","uid",$uid);
-	} elsif ($luid ne $uid){
-	    $msg.="changing uid: \"$luid\" -> \"$uid\"\n";
-	    ldif_action("replace","uid",$uid);
-	}
-	
-	# checking vhost uidNumber attribute
-	unless ($entry->get_value("uidNumber")){
-	    $msg.="adding dummy uidNumber: $dummyUid (This should be replaced later!\n)";
-	    ldif_action("add","uidNumber",$dummyUid);
-	}
+    }
+    elsif ( $oc{'ispmanVirtualHost'} ) {
 
-	# checking vhost gidNumber attribute
-	unless ($entry->get_value("gidNumber")){
-	    $msg.="adding dummy gidNumber: $dummyGid (This should be replaced later!)\n";
-	    ldif_action("add","gidNumber",$dummyGid);
-	}
+        # update ispmanVhost
+        my $ispmanDomain = $entry->get_value("ispmanDomain")
+          || die("ispmanDomain undefined!");
+        my $ispmanVhostName = $entry->get_value("ispmanVhostName")
+          || die("ispmanVhostName undefined!");
 
-	# checking vhost homeDirectory attribute
-	my $homedir=join '/', ($default_domainHomedir, $ispmanDomain, 'vhosts',
-			       $ispmanVhostName);
-	unless ($entry->get_value("homeDirectory")){
-	    $msg.="adding homeDirectory: \"$homedir\"\n";
-	    ldif_action("add","homeDirectory",$homedir);
-	}
-        
-	# checking vhost userPassword attribute
-	unless ($entry->get_value("userPassword")){
-	    $msg.="adding userPassword: \"$dummyPassword\" (This should be replaced later!)\n";
-	    ldif_action("add","userPassword",$dummyPassword);
-	}
+        # checking/replacing vhost objectclasses
+        $msg .= update_oc( $entry, \@oc, \@oc_virtualHost );
 
-	# checking vhost ispmanVhostDocumentRoot
-	my $docroot=$entry->get_value("ispmanVhostDocumentRoot");
-	if ($docroot){
-	    if ($docroot =~ /^$ispmanVhostName\//){
-		$msg.="NOTICE: ispmanVhostDocumentRoot looks like old entry\n";
-		my ($fixeddocroot)=$docroot=~m/^$ispmanVhostName\/(.*)/;
-		$msg.="changing ispmanVhostDocumentRoot: \"$docroot\" -> \"$fixeddocroot\"\n";
-		ldif_action("replace","ispmanVhostDocumentRoot",$fixeddocroot);
-	    }
-	} else {
-	    $msg.="ERROR: ispmanVhostDocumentRoot is missing!\n";
-	}
-	
-	# checking vhost ispmanVhostScriptDir
-	my $scdir=$entry->get_value("ispmanVhostScriptDir");
-	if ($scdir){
-	    if ($scdir =~ /^$ispmanVhostName\//){
-		$msg.="NOTICE: ispmanVhostDocumentRoot looks like old entry\n";
-		my ($fixedscdir)=$scdir=~m/^$ispmanVhostName\/(.*)/;
-		$msg.="changing ispmanVhostScriptDir: \"$scdir\" -> \"$fixedscdir\"\n";
-		ldif_action("replace","ispmanVhostScriptDir",$fixedscdir);
-	    }
-	} else {
-	    $msg.="ERROR: ispmanVhostScriptDir is missing!\n";
-	}
+        # checking vhost cn attribute
+        my $lcn = $entry->get_value("cn");
+        my $cn = join ".", ( $ispmanVhostName, $ispmanDomain );
+        if ( !defined $lcn ) {
+            $msg .= "adding cn with \"$cn\"\n";
+            ldif_action( "add", "cn", $cn );
+        }
+        elsif ( $lcn ne $cn ) {
+            $msg .= "changing cn: \"$lcn\" -> \"$cn\"\n";
+            ldif_action( "replace", "cn", $cn );
+        }
 
-	# checking vhost ispmanVhostLogdir attribute
-	my $logdir=$entry->get_value("ispmanVhostLogdir");
-	if ($logdir){
-	    if ($logdir =~ /^$ispmanVhostName\//){
-		$msg.="NOTICE: ispmanVhostLogdir looks like old entry\n";
-		my ($fixedlogdir)=$logdir=~m/^$ispmanVhostName\/(.*)/;
-		$msg.="changing ispmanVhostLogdir: \"$logdir\" -> \"$fixedlogdir\"\n";
-		ldif_action("replace","ispmanVhostLogdir",$fixedlogdir);
-	    }
-	} else {
-	    $msg.="WARNING: ispmanVhostLogdir is missing!\n";
-	    $msg.="adding ispmanVhostLogdir: \"logs\"\n";
-	    ldif_action("add","ispmanVhostLogdir","logs");
-	}
-	
-	# checking vhost ispmanVhostStatdir attribute
-	my $statdir=$entry->get_value("ispmanVhostStatdir");
-	if ($statdir){
-	    if ($statdir =~ /^$ispmanVhostName\//){
-		$msg.="NOTICE: ispmanVhostStatdir looks like old entry\n";
-		my ($fixedstatdir)=$statdir=~m/^$ispmanVhostName\/(.*)/;
-		$msg.="changing ispmanVhostStatdir: \"$statdir\" -> \"$fixedstatdir\"\n";
-		ldif_action("replace","ispmanVhostStatdir",$fixedstatdir);
-	    }
-	} else {
-	    $msg.="WARNING: ispmanVhostStatdir is missing!\n";
-	    $msg.="adding ispmanVhostStatdir: \"stats\"\n";
-	    ldif_action("add","ispmanVhostStatdir","stats");
-	}
+        # checking vhost uid attribute
+        my $luid = $entry->get_value("uid");
+        my $uid = join ".", ( $ispmanVhostName, $ispmanDomain );
+        if ( !defined $luid ) {
+            $msg .= "adding uid with \"$uid\"\n";
+            ldif_action( "add", "uid", $uid );
+        }
+        elsif ( $luid ne $uid ) {
+            $msg .= "changing uid: \"$luid\" -> \"$uid\"\n";
+            ldif_action( "replace", "uid", $uid );
+        }
 
-	# checking vhost loginShell
-	unless ($entry->get_value("loginshell")){
-	    $msg.="adding loginShell: $default_vhostShell\n";
-	    ldif_action("add","loginshell",$default_vhostShell);
-	}
-	
-	
-    } elsif ($oc{'ispmanDomainUser'}){
-	
-	# checking for alternate uid
-	my @uids=$entry->get_value("uid");
-	my $uid=join "@", $entry->get_value("ispmanUserId"),
-	                  $entry->get_value("ispmanDomain");
-	my $hasAlternateUid=0;
-	for (@uids) {
-	    if ($_ eq $uid) { $hasAlternateUid=1; }
-	}
-	if (! $hasAlternateUid) {
-	    $msg.="adding uid: \"$uid\"\n";
-	    ldif_action("add","uid",$uid);
-	}
+        # checking vhost uidNumber attribute
+        unless ( $entry->get_value("uidNumber") ) {
+            $msg .=
+"adding dummy uidNumber: $dummyUid (This should be replaced later!\n)";
+            ldif_action( "add", "uidNumber", $dummyUid );
+        }
 
-	# checking for bogus mailHost
-	if ($entry->get_value("mailHost") &&
-	    $entry->get_value("mailHost") eq "undefined"){
-	    $msg.="deleting mailhost: undefined\n";
-	    ldif_action("delete","mailhost","undefined");
-	}
+        # checking vhost gidNumber attribute
+        unless ( $entry->get_value("gidNumber") ) {
+            $msg .=
+"adding dummy gidNumber: $dummyGid (This should be replaced later!)\n";
+            ldif_action( "add", "gidNumber", $dummyGid );
+        }
 
-	# checking for bogus fileHost
-	if ($entry->get_value("fileHost") && 
-	    $entry->get_value("fileHost") eq "undefined"){
-	    $msg.="deleting filehost: undefined\n";
-	    ldif_action("delete","filehost","undefined");
-	}
+        # checking vhost homeDirectory attribute
+        my $homedir = join '/',
+          ( $default_domainHomedir, $ispmanDomain, 'vhosts', $ispmanVhostName );
+        unless ( $entry->get_value("homeDirectory") ) {
+            $msg .= "adding homeDirectory: \"$homedir\"\n";
+            ldif_action( "add", "homeDirectory", $homedir );
+        }
+
+        # checking vhost userPassword attribute
+        unless ( $entry->get_value("userPassword") ) {
+            $msg .=
+"adding userPassword: \"$dummyPassword\" (This should be replaced later!)\n";
+            ldif_action( "add", "userPassword", $dummyPassword );
+        }
+
+        # checking vhost ispmanVhostDocumentRoot
+        my $docroot = $entry->get_value("ispmanVhostDocumentRoot");
+        if ($docroot) {
+            if ( $docroot =~ /^$ispmanVhostName\// ) {
+                $msg .=
+                  "NOTICE: ispmanVhostDocumentRoot looks like old entry\n";
+                my ($fixeddocroot) = $docroot =~ m/^$ispmanVhostName\/(.*)/;
+                $msg .=
+"changing ispmanVhostDocumentRoot: \"$docroot\" -> \"$fixeddocroot\"\n";
+                ldif_action( "replace", "ispmanVhostDocumentRoot",
+                    $fixeddocroot );
+            }
+        }
+        else {
+            $msg .= "ERROR: ispmanVhostDocumentRoot is missing!\n";
+        }
+
+        # checking vhost ispmanVhostScriptDir
+        my $scdir = $entry->get_value("ispmanVhostScriptDir");
+        if ($scdir) {
+            if ( $scdir =~ /^$ispmanVhostName\// ) {
+                $msg .=
+                  "NOTICE: ispmanVhostDocumentRoot looks like old entry\n";
+                my ($fixedscdir) = $scdir =~ m/^$ispmanVhostName\/(.*)/;
+                $msg .=
+"changing ispmanVhostScriptDir: \"$scdir\" -> \"$fixedscdir\"\n";
+                ldif_action( "replace", "ispmanVhostScriptDir", $fixedscdir );
+            }
+        }
+        else {
+            $msg .= "ERROR: ispmanVhostScriptDir is missing!\n";
+        }
+
+        # checking vhost ispmanVhostLogdir attribute
+        my $logdir = $entry->get_value("ispmanVhostLogdir");
+        if ($logdir) {
+            if ( $logdir =~ /^$ispmanVhostName\// ) {
+                $msg .= "NOTICE: ispmanVhostLogdir looks like old entry\n";
+                my ($fixedlogdir) = $logdir =~ m/^$ispmanVhostName\/(.*)/;
+                $msg .=
+"changing ispmanVhostLogdir: \"$logdir\" -> \"$fixedlogdir\"\n";
+                ldif_action( "replace", "ispmanVhostLogdir", $fixedlogdir );
+            }
+        }
+        else {
+            $msg .= "WARNING: ispmanVhostLogdir is missing!\n";
+            $msg .= "adding ispmanVhostLogdir: \"logs\"\n";
+            ldif_action( "add", "ispmanVhostLogdir", "logs" );
+        }
+
+        # checking vhost ispmanVhostStatdir attribute
+        my $statdir = $entry->get_value("ispmanVhostStatdir");
+        if ($statdir) {
+            if ( $statdir =~ /^$ispmanVhostName\// ) {
+                $msg .= "NOTICE: ispmanVhostStatdir looks like old entry\n";
+                my ($fixedstatdir) = $statdir =~ m/^$ispmanVhostName\/(.*)/;
+                $msg .=
+"changing ispmanVhostStatdir: \"$statdir\" -> \"$fixedstatdir\"\n";
+                ldif_action( "replace", "ispmanVhostStatdir", $fixedstatdir );
+            }
+        }
+        else {
+            $msg .= "WARNING: ispmanVhostStatdir is missing!\n";
+            $msg .= "adding ispmanVhostStatdir: \"stats\"\n";
+            ldif_action( "add", "ispmanVhostStatdir", "stats" );
+        }
+
+        # checking vhost loginShell
+        unless ( $entry->get_value("loginshell") ) {
+            $msg .= "adding loginShell: $default_vhostShell\n";
+            ldif_action( "add", "loginshell", $default_vhostShell );
+        }
 
-	# checking loginShell
-	unless ($entry->get_value("loginshell")){
-	    $msg.="adding default loginShell: $default_loginShell\n";
-	    ldif_action("add","loginshell",$default_loginShell);
-	}
-	
-    } else {
-	# check other entries here	
-	
     }
-    
+    elsif ( $oc{'ispmanDomainUser'} ) {
+
+        # checking for alternate uid
+        my @uids = $entry->get_value("uid");
+        my $uid = join "@", $entry->get_value("ispmanUserId"),
+          $entry->get_value("ispmanDomain");
+        my $hasAlternateUid = 0;
+        for (@uids) {
+            if ( $_ eq $uid ) { $hasAlternateUid = 1; }
+        }
+        if ( !$hasAlternateUid ) {
+            $msg .= "adding uid: \"$uid\"\n";
+            ldif_action( "add", "uid", $uid );
+        }
+
+        # checking for bogus mailHost
+        if (   $entry->get_value("mailHost")
+            && $entry->get_value("mailHost") eq "undefined" )
+        {
+            $msg .= "deleting mailhost: undefined\n";
+            ldif_action( "delete", "mailhost", "undefined" );
+        }
+
+        # checking for bogus fileHost
+        if (   $entry->get_value("fileHost")
+            && $entry->get_value("fileHost") eq "undefined" )
+        {
+            $msg .= "deleting filehost: undefined\n";
+            ldif_action( "delete", "filehost", "undefined" );
+        }
+
+        # checking loginShell
+        unless ( $entry->get_value("loginshell") ) {
+            $msg .= "adding default loginShell: $default_loginShell\n";
+            ldif_action( "add", "loginshell", $default_loginShell );
+        }
+
+    }
+    else {
+
+        # check other entries here
+
+    }
+
     ## check that RDN is also attribute/value pair
 
     # get the RDN as attr/value
-    my ($attrib, $attribval)=$dn=~m/^(\w+)?\=([^,]*)/;
-    my @values=$entry->get_value($attrib);
-    my $found=0;
+    my ( $attrib, $attribval ) = $dn =~ m/^(\w+)?\=([^,]*)/;
+    my @values = $entry->get_value($attrib);
+    my $found  = 0;
     for (@values) {
-	if ($_ eq $attribval) { $found=1 }
+        if ( $_ eq $attribval ) { $found = 1 }
     }
-    if (! $found) {
-	$msg.="adding RDN to attributes ($attrib: $attribval)\n";
-	ldif_action("add",$attrib,$attribval);
+    if ( !$found ) {
+        $msg .= "adding RDN to attributes ($attrib: $attribval)\n";
+        ldif_action( "add", $attrib, $attribval );
     }
 
     # output msg
-    if ($msg){
-	print STDERR "DN: $dn\n";
-	print STDERR $msg,"\n";
+    if ($msg) {
+        print STDERR "DN: $dn\n";
+        print STDERR $msg, "\n";
     }
-    
+
     #print $entry->dn(), "\n";
     #print $entry->dump(), "\n";
     #$entry->dump();
 
     # write changed entry
-    if ($mode eq "add"){
-	$ldif_out->write_entry($entry);
-    } elsif ($chng) {
-	print OUTLDIF "dn: $dn\n";
-	print OUTLDIF "changetype: modify\n";
-	print OUTLDIF $chng;
-	print OUTLDIF "\n";
+    if ( $mode eq "add" ) {
+        $ldif_out->write_entry($entry);
+    }
+    elsif ($chng) {
+        print OUTLDIF "dn: $dn\n";
+        print OUTLDIF "changetype: modify\n";
+        print OUTLDIF $chng;
+        print OUTLDIF "\n";
     }
 }
 
 $ldif_in->done();
 
-if ($mode eq "add"){
+if ( $mode eq "add" ) {
     $ldif_out->done();
-} else {
+}
+else {
     close(OUTLDIF);
 }
 
-
-
-
 __END__
 

Index: ldif2ldap
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/ldif2ldap,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ldif2ldap	15 Feb 2004 20:55:22 -0000	1.8
+++ ldif2ldap	30 May 2004 23:35:39 -0000	1.9
@@ -1,93 +1,90 @@
 #!/usr/bin/perl
 package ISPMan;
 use lib qw(lib ../lib /opt/ispman/lib);
-BEGIN{
-   use Getopt::Std;
-   getopt('hbDwf',  \%opts);
-   unless ($opts{'h'} && $opts{'D'}&& $opts{'w'}&& $opts{'f'}){
-      my ($script)= reverse split ("/", $0);
-      print "$script. A utility to load data from ldif to ldap\n\n";
-      print "Usage: $script -h hostname -D 'admin DN' -w adminPass -f filename";
-      print "\n\n";
-      exit;
-   }
+
+BEGIN {
+    use Getopt::Std;
+    getopt( 'hbDwf', \%opts );
+    unless ( $opts{'h'} && $opts{'D'} && $opts{'w'} && $opts{'f'} ) {
+        my ($script) = reverse split( "/", $0 );
+        print "$script. A utility to load data from ldif to ldap\n\n";
+        print
+          "Usage: $script -h hostname -D 'admin DN' -w adminPass -f filename";
+        print "\n\n";
+        exit;
+    }
 }
 
 use Net::LDAP;
 use Net::LDAP::Util qw(ldap_error_text
-                         ldap_error_name
-                         ldap_error_desc
-                        );
-;
+  ldap_error_name
+  ldap_error_desc
+);
 use Net::LDAP::LDIF;
 use Net::LDAP::Entry;
-  
-use vars qw($ldif $entry);
-
-$ldif = Net::LDAP::LDIF->new( $opts{'f'});
-
-
-
 
+use vars qw($ldif $entry);
 
+$ldif = Net::LDAP::LDIF->new( $opts{'f'} );
 
-if ($LDAP=Net::LDAP->new($opts{'h'})){
-   my $result=$LDAP->bind(dn => $opts{'D'}, password => $opts{'w'});
-   if ($result->code) {
+if ( $LDAP = Net::LDAP->new( $opts{'h'} ) ) {
+    my $result = $LDAP->bind( dn => $opts{'D'}, password => $opts{'w'} );
+    if ( $result->code ) {
         print $result->error, "\n";
         exit;
 
-   }
-} else {
-  print "Cannot make a connection to LDAP server";
-  exit;
+    }
+}
+else {
+    print "Cannot make a connection to LDAP server";
+    exit;
 }
 
-
-while( not $ldif->eof() ) {
-     $entry = $ldif->read_entry();
-     if ( $ldif->error() ) {
-        print "Error msg: ",$ldif->error(),"\n";
-        print "Error lines:\n",$ldif->error_lines(),"\n";
-     }
-     else {
+while ( not $ldif->eof() ) {
+    $entry = $ldif->read_entry();
+    if ( $ldif->error() ) {
+        print "Error msg: ",    $ldif->error(),       "\n";
+        print "Error lines:\n", $ldif->error_lines(), "\n";
+    }
+    else {
         $entry->changetype("add");
 
-        print $entry->dn(), "\n";
+        print $entry->dn(),   "\n";
         print $entry->dump(), "\n";
-        try($entry->update($LDAP));
+        try( $entry->update($LDAP) );
+
         #$entry->dump();
         # do stuff
-     }
-  }
-  $ldif->done();
+    }
+}
+$ldif->done();
 
 sub try {
-   my $result=shift;
-   if ( $result->code ) {
-      LDAPerror("Searching",$result);
-      return 0;
-   } else {
-      return 1;
-   }
+    my $result = shift;
+    if ( $result->code ) {
+        LDAPerror( "Searching", $result );
+        return 0;
+    }
+    else {
+        return 1;
+    }
 }
 
-sub LDAPerror{
-   my ($from,$mesg) = @_;
-   print "\n";
-   
-   print "Return code: ", $mesg->code , "\n";
-   print "Error name: ",  ldap_error_name($mesg->code)  , "\n";
-   print "Error text: ",  ldap_error_text($mesg->code)  , "\n";
-   print "Error desc: ",  ldap_error_desc($mesg->code)  , "\n";
-   print "MessageID: ",$mesg->mesg_id , "\n";
-   print "Error: ", $mesg->error , "\n";
-   print "Server Error: ", $mesg->server_error , "\n";
-   
-   
-   print "DN: ",$mesg->dn , "\n";
-   
-   print "\n\n";
+sub LDAPerror {
+    my ( $from, $mesg ) = @_;
+    print "\n";
+
+    print "Return code: ", $mesg->code, "\n";
+    print "Error name: ", ldap_error_name( $mesg->code ), "\n";
+    print "Error text: ", ldap_error_text( $mesg->code ), "\n";
+    print "Error desc: ", ldap_error_desc( $mesg->code ), "\n";
+    print "MessageID: ",    $mesg->mesg_id,      "\n";
+    print "Error: ",        $mesg->error,        "\n";
+    print "Server Error: ", $mesg->server_error, "\n";
+
+    print "DN: ", $mesg->dn, "\n";
+
+    print "\n\n";
 }
 
 __END__

Index: subs.pl
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/subs.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- subs.pl	16 Jan 2002 23:41:00 -0000	1.2
+++ subs.pl	30 May 2004 23:35:39 -0000	1.3
@@ -1,15 +1,17 @@
 #!/usr/bin/perl
 require "tmp/vars.pl";
-for (<>){
-	s/%%(\w+)?%%/$VAR1->{$1}{'default'}/g;
-	s/\@\@(randcrypt.*?)\@\@/eval($1)/ge;
-        print
+for (<>) {
+    s/%%(\w+)?%%/$VAR1->{$1}{'default'}/g;
+    s/\@\@(randcrypt.*?)\@\@/eval($1)/ge;
+    print;
 }
 
 sub randcrypt {
-      my $string=shift;
-      #print "Getting $string\n\n";
-      return crypt($string, join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64]);
-   }
+    my $string = shift;
 
+    #print "Getting $string\n\n";
+    return
+      crypt( $string, join '',
+        ( '.', '/', 0 .. 9, 'A' .. 'Z', 'a' .. 'z' )[ rand 64, rand 64 ] );
+}
 

Index: v2tov3.pl
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/v2tov3.pl,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- v2tov3.pl	24 Apr 2003 20:51:22 -0000	1.9
+++ v2tov3.pl	30 May 2004 23:35:39 -0000	1.10
@@ -1,45 +1,45 @@
 #!/usr/bin/perl
 package ISPMan;
 use lib qw(ispman-utils/lib ../ispman-utils/lib /opt/ispman/lib);
-BEGIN{
-   use Getopt::Std;
-   getopt('c',  \%opts);
-   unless ($opts{'c'}){
-      my ($script)= reverse split ("/", $0);
-      print "$script. A utility to convert your old LDAP data to new schema\n\n";
-      print "Usage: $script -c /path/to/ispman.conf";
-      print "\n\n";
[...1359 lines suppressed...]
 
-}
+        #print "$string Getting ARRAY <br>";
+        my @newstring = ();
+        my $str;
+        for $str (@$string) {
+            push @newstring, $converter->convert($str);
+        }
+        return \@newstring;
+    }
+    else {
 
+        #print "$string Getting SCALAR <br>";
+        return $converter->convert($string);
+    }
 
+}
 
 __END__
 

Index: schema2ldif.pl
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/schema2ldif.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- schema2ldif.pl	4 May 2002 23:24:06 -0000	1.2
+++ schema2ldif.pl	30 May 2004 23:35:39 -0000	1.3
@@ -1,50 +1,51 @@
 #!/usr/bin/perl
-unless ($ARGV[0] || (-e $ARGV[0] && -f $ARGV[0])){
-   print "Usage: $0 schema_file type\n";
-   print "type: ibm|iplanet\n";
-   exit;
+unless ( $ARGV[0] || ( -e $ARGV[0] && -f $ARGV[0] ) ) {
+    print "Usage: $0 schema_file type\n";
+    print "type: ibm|iplanet\n";
+    exit;
 }
 
-$vendor=$ARGV[1]||"iplanet";
+$vendor = $ARGV[1] || "iplanet";
 
 print "dn: cn=schema\n" if $type eq "iplanet";
-$c=-1;
-for (<>){
-        s/^ //g;
-        next unless /\S/;
-        next if /^#/;
-        #print;
-        if (/^\s*objectclass/i) {
-           $c++;
-           $type="objectclass";
-        }
-        if (/^\s*attributetype/i) {
-           $c++;
-           $type="attribute";
-        }
+$c = -1;
+for (<>) {
+    s/^ //g;
+    next unless /\S/;
+    next if /^#/;
 
-        $data->{$type}[$c].=$_;
+    #print;
+    if (/^\s*objectclass/i) {
+        $c++;
+        $type = "objectclass";
+    }
+    if (/^\s*attributetype/i) {
+        $c++;
+        $type = "attribute";
+    }
+
+    $data->{$type}[$c] .= $_;
 }
 
-$oc->{'iplanet'}="objectClass:";
-$oc->{'ibm'}="objectClass=";
-$at->{'iplanet'}="attributeTypes:";
-$at->{'ibm'}="attributeTypes=";
+$oc->{'iplanet'} = "objectClass:";
+$oc->{'ibm'}     = "objectClass=";
+$at->{'iplanet'} = "attributeTypes:";
+$at->{'ibm'}     = "attributeTypes=";
 
-   for $type (keys %$data) {
-   $array=$data->{$type};
-   ELEMENT: for $element(@$array) {
-      $element=~s/\n/ /g;
-      $element=~s/\t/ /g;
-      $element=~s/ {2}/ /g;
+for $type ( keys %$data ) {
+    $array = $data->{$type};
+  ELEMENT: for $element (@$array) {
+        $element =~ s/\n/ /g;
+        $element =~ s/\t/ /g;
+        $element =~ s/ {2}/ /g;
 
-      $element=~s/^objectclass\s*\(\s*/$oc->{$vendor} ( /gi;
-      $element=~s/^attributetype\s*\(\s*/$at->{$vendor} ( /gi;
-      $element=~s/ $//g;
-      $element=~s/\)$/ \)/;
-   next ELEMENT unless $element=~/\S/;
-   print "$element\n";
-   }
+        $element =~ s/^objectclass\s*\(\s*/$oc->{$vendor} ( /gi;
+        $element =~ s/^attributetype\s*\(\s*/$at->{$vendor} ( /gi;
+        $element =~ s/ $//g;
+        $element =~ s/\)$/ \)/;
+        next ELEMENT unless $element =~ /\S/;
+        print "$element\n";
+    }
 
 }
 

Index: getvar.pl
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/getvar.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- getvar.pl	3 Feb 2002 09:34:55 -0000	1.2
+++ getvar.pl	30 May 2004 23:35:39 -0000	1.3
@@ -1,6 +1,6 @@
-if (-e "tmp"){
-require "tmp/vars.pl"; 
-print $VAR1->{$ARGV[0]}{'default'};
+if ( -e "tmp" ) {
+    require "tmp/vars.pl";
+    print $VAR1->{ $ARGV[0] }{'default'};
 }
 exit(0);
 

Index: make.pl
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/make.pl,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- make.pl	24 May 2004 20:56:31 -0000	1.20
+++ make.pl	30 May 2004 23:35:39 -0000	1.21
@@ -1,9 +1,9 @@
 #!/usr/bin/perl
 #Author: Atif Ghaffar
 
-
 #---------------------------------------------------------------------
 package Text::Wrapper;
+
 #
 # Copyright 1998 Christopher J. Madsen
 #
@@ -30,90 +30,94 @@
 #=====================================================================
 # Package Global Variables:
 
-BEGIN
-{
+BEGIN {
+
     # Convert RCS revision number to d.ddd format:
-    $VERSION = sprintf('%d.%03d', '1.000 ' =~ /(\d+)\.(\d+)/);
-} # end BEGIN
+    $VERSION = sprintf( '%d.%03d', '1.000 ' =~ /(\d+)\.(\d+)/ );
+}    # end BEGIN
 
 #=====================================================================
 # Methods:
 #---------------------------------------------------------------------
 # Provide methods for getting/setting fields:
 
-sub AUTOLOAD
-{
+sub AUTOLOAD {
     my $self = $_[0];
     my $type = ref($self) or croak("$self is not an object");
     my $name = $AUTOLOAD;
-    $name =~ s/.*://;   # strip fully-qualified portion
+    $name =~ s/.*://;    # strip fully-qualified portion
     my $field = $name;
-    $field =~ s/_([a-z])/\u$1/g; # squash underlines into mixed case
-    unless (exists $self->{$field}) {
+    $field =~ s/_([a-z])/\u$1/g;    # squash underlines into mixed case
+    unless ( exists $self->{$field} ) {
+
         # Ignore special methods like DESTROY:
         return undef if $name =~ /^[A-Z]+$/;
         croak("Can't locate object method \"$name\" via package \"$type\"");
     }
     return $self->{$field} = $_[1] if $#_;
     $self->{$field};
-} # end AUTOLOAD
+}    # end AUTOLOAD
 
 #---------------------------------------------------------------------
-sub new
-{
+sub new {
     my $self = bless {
         'bodyStart' => '',
         'columns'   => 70,
         'parStart'  => '',
-    }, shift;
+      },
+      shift;
 
-    croak "Missing parameter" unless (scalar @_ % 2) == 0;
+    croak "Missing parameter" unless ( scalar @_ % 2 ) == 0;
     while (@_) {
         $AUTOLOAD = shift;
-        defined eval { &AUTOLOAD($self, shift) }
-        or croak("Unknown parameter `$AUTOLOAD'");
+        defined eval { &AUTOLOAD( $self, shift ) }
+          or croak("Unknown parameter `$AUTOLOAD'");
     }
 
     $self;
-} # end new
+}    # end new
 
 #---------------------------------------------------------------------
-sub wrap
-{
-    my $self = shift;
-    my $width = $self->{'columns'};
-    my $text = $self->{'parStart'};
-    my $length = length $text;
-    my $lineStart = $length;
-    my $parStart = $text;
+sub wrap {
+    my $self        = shift;
+    my $width       = $self->{'columns'};
+    my $text        = $self->{'parStart'};
+    my $length      = length $text;
+    my $lineStart   = $length;
+    my $parStart    = $text;
     my $parStartLen = $length;
-    my $continue = "\n" . $self->{'bodyStart'};
-    my $contLen  = length $self->{'bodyStart'};
-    pos($_[0]) = 0;             # Make sure we start at the beginning
-    for (;;) {
-        if ($_[0] =~ m/\G[ \t]*(\n+)/gc) {
+    my $continue    = "\n" . $self->{'bodyStart'};
+    my $contLen     = length $self->{'bodyStart'};
+    pos( $_[0] ) = 0;    # Make sure we start at the beginning
+
+    for ( ; ; ) {
+        if ( $_[0] =~ m/\G[ \t]*(\n+)/gc ) {
             $text .= $1 . $parStart;
             $lineStart = $length = $parStartLen;
-        } else {
+        }
+        else {
             $_[0] =~ m/\G(\s*(?:[^-\s]+-*|\S+))/g or last;
             my $word = $1;
           again:
-            if (($length + length $word <= $width) or ($length == $lineStart)) {
+            if (   ( $length + length $word <= $width )
+                or ( $length == $lineStart ) )
+            {
                 $length += length $word;
                 $text .= $word;
-            } else {
+            }
+            else {
                 $text .= $continue;
                 $lineStart = $length = $contLen;
                 $word =~ s/^\s+//;
                 goto again;
             }
         }
-    } # end forever
-    if ($length != $lineStart) { $text .= "\n" }
+    }    # end forever
+    if ( $length != $lineStart ) { $text .= "\n" }
     else { $text =~ s/(?:\Q$continue\E|\n\Q$parStart\E)\Z/\n/ }
 
     $text;
-} # end wrap
+}    # end wrap
 
 #=====================================================================
 # Package Return Value:
@@ -125,20 +129,18 @@
 package main;
 no strict;
 
-$wrapper = Text::Wrapper->new(columns => 60);
-
-
+$wrapper = Text::Wrapper->new( columns => 60 );
 
-$OLD_CONF_FILE="/etc/ispman/conf/ispman.conf";
-$CONF_FILE="tmp/conf/ispman.conf";
-$LDAP_CONF="tmp/conf/ldap.conf";
-$SLAPD_CONF="tmp/conf/slapd.conf";
-$LDIF_DIR="tmp/ldif";
-$INSTALL_TIMESTAMP=0;
-$ISUPDATE=0;
-$HOSTNAME=$ENV{'HOSTNAME'}||`hostname`;
+$OLD_CONF_FILE     = "/etc/ispman/conf/ispman.conf";
+$CONF_FILE         = "tmp/conf/ispman.conf";
+$LDAP_CONF         = "tmp/conf/ldap.conf";
+$SLAPD_CONF        = "tmp/conf/slapd.conf";
+$LDIF_DIR          = "tmp/ldif";
+$INSTALL_TIMESTAMP = 0;
+$ISUPDATE          = 0;
+$HOSTNAME          = $ENV{'HOSTNAME'} || `hostname`;
 chomp $HOSTNAME;
-$PWD=$ENV{'PWD'};
+$PWD = $ENV{'PWD'};
 system("clear");
 
 #this hashref defines sections that we need to configure and their descriptions.
@@ -147,373 +149,358 @@
 #vars is the list of vars that we should set. See $vars hashref
 #optional  . err I forgot what that for.
 
-
-my $vars_info={
-   conf_vars =>{
-      'description' => qq|
+my $vars_info = {
+    conf_vars => {
+        'description' => qq|
          These are minimum questions that we will keep in the configuration file.
          The rest of the information will be kept in the LDAP directory and can
 			be edited using the web interface.
       |,
-      'vars' => [qw(
-         domain
-         rootEmail
-         ldapBaseDN 
-         ldapRootDN 
-         ldapRootPass 
-         ldapHost 
-         ldapInstallPath
-         ldapVersion
-         imapAdminUsername
-         imapAdminPass
-         imapPort
-         installDir
-         debug
-         logmethod
-         logfacility
-         logsock
-         minuid
-         maxuid
-         mingid
-         maxgid
-	)],
-      'optional' => 1,  # this should not be 1 , otherwise default substitution will take place
-   },
-   web_vars =>{
-      'description' => qq|
+        'vars' => [
+            qw(
+              domain
+              rootEmail
+              ldapBaseDN
+              ldapRootDN
+              ldapRootPass
+              ldapHost
+              ldapInstallPath
+              ldapVersion
+              imapAdminUsername
+              imapAdminPass
+              imapPort
+              installDir
+              debug
+              logmethod
+              logfacility
+              logsock
+              minuid
+              maxuid
+              mingid
+              maxgid
+              )
+        ],
+        'optional' => 1
+        , # this should not be 1 , otherwise default substitution will take place
+    },
+    web_vars => {
+        'description' => qq|
          These are minimum questions that relate to web installation
       |,
-      'vars' => [qw(ispmanUrlPrefix)],
-      'optional' => 1,  # this should not be 1 , otherwise default substitution will take place
-   },
-   
-};
+        'vars'     => [qw(ispmanUrlPrefix)],
+        'optional' => 1
+        , # this should not be 1 , otherwise default substitution will take place
+    },
 
-                                                                                                                           
+};
 
 #this hahref holds all variables that we need to set
 #local defines that its only for install.pl use and no question is asked to the user.
 # anything between %% and %% is evaluated as a key  of the  hashref $vars
 #example %%hostname%% gets the value from $vars->{'hostname'}
 
-my $vars={
-   hostname => {
-      'default' => $HOSTNAME,
-      'question' =>"",
-      'local' => 1,
-   },
+my $vars = {
+    hostname => {
+        'default'  => $HOSTNAME,
+        'question' => "",
+        'local'    => 1,
+    },
 
-   domain => {
-      'default' => "",
-      'question' => "What is your domain? ",
-   },
+    domain => {
+        'default'  => "",
+        'question' => "What is your domain? ",
+    },
 
-   minuid	=> {
-           default => '1000',
-           question => "When creating users or domains, what is the minimum uid that I should use",
-   },
-   maxuid	=> {
-           default => '9999',
-           question => "When creating users or domains, what is the maximum uid that I should use",
-   },
-   mingid	=> {
-           default => '1000',
-           question => "When creating users or domains, what is the minimum gid that I should use",
-   },
-   maxgid	=> {
-           default => '9999',
-           question => "When creating users or domains, what is the maximum gid that I should use",
-   },
-   debug => {
-           default => '1',
-           question => "Whats the debug level that you would like for this box? 
+    minuid => {
+        default  => '1000',
+        question =>
+"When creating users or domains, what is the minimum uid that I should use",
+    },
+    maxuid => {
+        default  => '9999',
+        question =>
+"When creating users or domains, what is the maximum uid that I should use",
+    },
+    mingid => {
+        default  => '1000',
+        question =>
+"When creating users or domains, what is the minimum gid that I should use",
+    },
+    maxgid => {
+        default  => '9999',
+        question =>
+"When creating users or domains, what is the maximum gid that I should use",
+    },
+    debug => {
+        default  => '1',
+        question => "Whats the debug level that you would like for this box? 
            0: none, 
            1: light, 
            2: heavy, 
            3: very heavy for debugging",
-           
-   },
-   
-   logmethod => {
-           default => 'syslog',
-           question => "Whats the log method that you would like? old | syslog
+
+    },
+
+    logmethod => {
+        default  => 'syslog',
+        question => "Whats the log method that you would like? old | syslog
            Method 'syslog' is preferred method, because you can log centrally on a syslog server. 
            Method 'old'  prints the logs to STDERR if run from shell or to apache's error log if run via HTTP",
-   },
-   
-   logfacility => {
-           default => 'local5',
-           question => "
+    },
+
+    logfacility => {
+        default  => 'local5',
+        question => "
            Log facility that you would like to use with syslog? 
            Ignore, if you are using 'old' as log method",
-   },
-   
-   logsock => {
-           default => 'unix',
-           question => "Log socket for syslog unix | inet
+    },
+
+    logsock => {
+        default  => 'unix',
+        question => "Log socket for syslog unix | inet
            Use 'unix' if you want to use a unix socket to log to local syslog server.
            Use 'inet' if you are loging to a remote server, or if 'unix' does not work for you.
            Ignore, if you are using file based logging",
-   },
-   
-      ldapInstallPath => {
-              default => '/etc/openldap',
-              question => "path to ldap configuration directory.",
-      },
+    },
 
-      ldapRootPass => {
-              default => 'secret',
-              question => "Password for the LDAP administrator",
-              
-      },
-      ldapHost => {
-              default => 'localhost',
-              question => "Host name of master LDAP server.\n",
-      },
-      ldapBaseDN => {
-                default => $ENV{'ldapBaseDN'} || 'o=ispman',
-                question => "LDAP base DN.",
-                
-      },
-      ldapRootDN => {
-                default => 'cn=Directory Administrator, %%ldapBaseDN%%',
-                question => "RootDN (Admin's DN) for the LDAP server",
-                
-      },
-      ldapVersion => {
-                default => 3,
-                question => "What is the LDAP version your server is running?",
-      },
-	imapAdminPass => {
-		default => 'cyrus',
-		question => "Password for the Cyrus admin",
-		
-	},
-	imapPort => {
-		default => '143',
-		question => "IMAP port",
-		
-	},
-	imapAdminUsername => {
-		default => 'cyrus',
-		question => "Cyrus Admin's username",
-		
-	},
-        rootEmail => {
-		default => 'root@%%domain%%',
-		question => "Email of the administrator.\nThis email adress is used to send emails if something fails",
-		
-	},
-	
-	installDir => {
-		default => $ENV{'ISPMAN_INSTALL_PATH'},
-		question => "Directory where you want to install ispman components.\nVery Important.",
-		
-	},
-  
-        ispmanUrlPrefix => {
-               default=>"",
-               question => "prefix for ispman URI.\nIf you want to run on a dedicated server or a Virtualhost, \nyou can leave this value blank\n\nPlease leave it blank at the moment",
-               },
+    ldapInstallPath => {
+        default  => '/etc/openldap',
+        question => "path to ldap configuration directory.",
+    },
 
-  };
+    ldapRootPass => {
+        default  => 'secret',
+        question => "Password for the LDAP administrator",
+
+    },
+    ldapHost => {
+        default  => 'localhost',
+        question => "Host name of master LDAP server.\n",
+    },
+    ldapBaseDN => {
+        default => $ENV{'ldapBaseDN'} || 'o=ispman',
+        question => "LDAP base DN.",
 
+    },
+    ldapRootDN => {
+        default  => 'cn=Directory Administrator, %%ldapBaseDN%%',
+        question => "RootDN (Admin's DN) for the LDAP server",
 
+    },
+    ldapVersion => {
+        default  => 3,
+        question => "What is the LDAP version your server is running?",
+    },
+    imapAdminPass => {
+        default  => 'cyrus',
+        question => "Password for the Cyrus admin",
 
-if (-e $OLD_CONF_FILE){
-	$ISUPDATE=1;
-        $existing_config=$OLD_CONF_FILE;
-}
+    },
+    imapPort => {
+        default  => '143',
+        question => "IMAP port",
 
-if (-e $CONF_FILE){
-	$ISUPDATE=1;
-        $existing_config=$CONF_FILE;
-}
+    },
+    imapAdminUsername => {
+        default  => 'cyrus',
+        question => "Cyrus Admin's username",
 
+    },
+    rootEmail => {
+        default  => 'root@%%domain%%',
+        question =>
+"Email of the administrator.\nThis email adress is used to send emails if something fails",
 
-if (-e "/opt/ispman/conf/ispman.conf"){
-	#this is the most recent
-        $ISUPDATE=1;
-        $existing_config="/opt/ispman/conf/ispman.conf";
-}
+    },
+
+    installDir => {
+        default  => $ENV{'ISPMAN_INSTALL_PATH'},
+        question =>
+"Directory where you want to install ispman components.\nVery Important.",
 
+    },
 
+    ispmanUrlPrefix => {
+        default  => "",
+        question =>
+"prefix for ispman URI.\nIf you want to run on a dedicated server or a Virtualhost, \nyou can leave this value blank\n\nPlease leave it blank at the moment",
+    },
 
+};
 
+if ( -e $OLD_CONF_FILE ) {
+    $ISUPDATE        = 1;
+    $existing_config = $OLD_CONF_FILE;
+}
 
-if ($ISUPDATE) {
-	print "Existing ISPMan installation found\nReading defaults from $existing_config\n";
-	do $existing_config;
-	*Config=*ISPMan::Config;
-	$Config->{'imapHosts'}=join " ", @{$Config->{'imapHosts'}};
-	for (keys %$Config){
-		$vars->{$_}{'default'}=$Config->{$_};
-	}
+if ( -e $CONF_FILE ) {
+    $ISUPDATE        = 1;
+    $existing_config = $CONF_FILE;
+}
+
+if ( -e "/opt/ispman/conf/ispman.conf" ) {
+
+    #this is the most recent
+    $ISUPDATE        = 1;
+    $existing_config = "/opt/ispman/conf/ispman.conf";
 }
 
+if ($ISUPDATE) {
+    print
+"Existing ISPMan installation found\nReading defaults from $existing_config\n";
+    do $existing_config;
+    *Config = *ISPMan::Config;
+    $Config->{'imapHosts'} = join " ", @{ $Config->{'imapHosts'} };
+    for ( keys %$Config ) {
+        $vars->{$_}{'default'} = $Config->{$_};
+    }
+}
 
 # this function subtitute the %%someting%% struct recursively and returns the value
 # I am not sure about the recursive part, can someone please check and verify
 sub getVar {
-   my ($key, $branch)=@_;
-   my $val=$vars->{$key}{$branch};
-   ""=~/()/;
-   $val=~s/%%(\w*)?%%/getVar($1, 'default')/ge;
-   
-   my @lines=();
-
-   if ($branch eq "question") {
-      @lines=split (/\n/, $val);
-      for (@lines) {
-         s/^ *//;
-      }
-      $val=join "\n", "", $wrapper->wrap(join "\n", @lines);
-   }
-   return $val;
-}
+    my ( $key, $branch ) = @_;
+    my $val = $vars->{$key}{$branch};
+    ""   =~ /()/;
+    $val =~ s/%%(\w*)?%%/getVar($1, 'default')/ge;
 
+    my @lines = ();
 
+    if ( $branch eq "question" ) {
+        @lines = split( /\n/, $val );
+        for (@lines) {
+            s/^ *//;
+        }
+        $val = join "\n", "", $wrapper->wrap( join "\n", @lines );
+    }
+    return $val;
+}
 
 # sets default values after substition if
 # optional was set to 1 for $vars_info{$_}
 sub setDefaults {
-	print "Setting Defaults\n";
-	for (@_) {
-		$vars->{$_}{'default'}=getVar($_, 'default');
-		print "\t$_=$vars->{$_}{'default'}\n";
-	}
+    print "Setting Defaults\n";
+    for (@_) {
+        $vars->{$_}{'default'} = getVar( $_, 'default' );
+        print "\t$_=$vars->{$_}{'default'}\n";
+    }
 }
 
-
-
 # this routine asks questions and saves defaults in the vars hash
-sub configure{
-	for (@_) {
-           $question=getVar($_, 'question');
-		if ($question=~/\S/) {
-			print $question;
-			if ($vars->{$_}{'default'}=~/\S/) {
-				print " [";
-				print getVar($_, 'default');
-				print "]: ";
-			}
-			chomp(my $answer=<>);
-			if ($answer) {
-				$vars->{$_}{'default'}=$answer;
-			} else {
-				$vars->{$_}{'default'}=getVar($_, 'default');
-			}
-		}
-	
-	}
-}
-
+sub configure {
+    for (@_) {
+        $question = getVar( $_, 'question' );
+        if ( $question =~ /\S/ ) {
+            print $question;
+            if ( $vars->{$_}{'default'} =~ /\S/ ) {
+                print " [";
+                print getVar( $_, 'default' );
+                print "]: ";
+            }
+            chomp( my $answer = <> );
+            if ($answer) {
+                $vars->{$_}{'default'} = $answer;
+            }
+            else {
+                $vars->{$_}{'default'} = getVar( $_, 'default' );
+            }
+        }
 
+    }
+}
 
 sub write_config {
-	system("clear");
-	print "Writing ispman.conf";
-        open ("F", ">$CONF_FILE") or die "Cant open $CONF_FILE $!";
-	print F "package ISPMan;\n";
-
-        my $key;
-	my $text="";
-	for $key(keys %$vars_info) {
-		my $description=$vars_info->{$key}{'description'};
-		$description=~s/\n/\n# /g;
-		print F "\n# $description\n";
-		print F "\n";
-		for my $var(@{$vars_info->{$key}{'vars'}}){
-                        next if exists $vars->{$var}{'local'}; 
-			
-                        my $val=$vars->{$var}{'default'};
-			##$val=~s/\@/\\@/g; #for the email address
-			$text="\$Config->\{'$var'}";
-			$text.=" " x (50-length($text)); # just beautifying
-			$text.="= \'$val\';";
-			print F "$text\n";
-		
-		}
-	}
-
+    system("clear");
+    print "Writing ispman.conf";
+    open( "F", ">$CONF_FILE" ) or die "Cant open $CONF_FILE $!";
+    print F "package ISPMan;\n";
 
+    my $key;
+    my $text = "";
+    for $key ( keys %$vars_info ) {
+        my $description = $vars_info->{$key}{'description'};
+        $description =~ s/\n/\n# /g;
+        print F "\n# $description\n";
+        print F "\n";
+        for my $var ( @{ $vars_info->{$key}{'vars'} } ) {
+            next if exists $vars->{$var}{'local'};
 
+            my $val = $vars->{$var}{'default'};
+            ##$val=~s/\@/\\@/g; #for the email address
+            $text = "\$Config->\{'$var'}";
+            $text .= " " x ( 50 - length($text) );    # just beautifying
+            $text .= "= \'$val\';";
+            print F "$text\n";
 
+        }
+    }
 
-        #print F "\n1;\n";
-	close(F);
+    #print F "\n1;\n";
+    close(F);
 }
 
-
-
-
 sub main {
-	for (qw(conf_vars)){
-		print "\n";
-		print "*"x72, "\n";
-		
-                # just a convinience.
-                # to neatly define description in the hash, without worrying about the white space displaying.
-                $vars_info->{$_}{'description'}=~s/\n/<br> /g;
-		$vars_info->{$_}{'description'}=~s/\s\s+//g;
-		$vars_info->{$_}{'description'}=~s/\<br>/\n/g;
-
-		print $vars_info->{$_}{'description'};
-		print "\n";
-		print "*"x72, "\n";
-		if ($vars_info->{$_}{'optional'}) {
-			print "You may skip this section to get the default values\nDo you want to set them up? y/n [y] ";
-			chomp(my $ans=<>);
-			if ($ans=~/^\s*n/i){
-				setDefaults(@{$vars_info->{$_}{'vars'}});
-				next;
-			}
-			$vars_info->{$_}{'set'}=1;
-		}
-		configure(@{$vars_info->{$_}{'vars'}});
-		system("clear");
-	}
-	write_config();
-}
-
-
+    for (qw(conf_vars)) {
+        print "\n";
+        print "*" x 72, "\n";
 
+# just a convinience.
+# to neatly define description in the hash, without worrying about the white space displaying.
+        $vars_info->{$_}{'description'} =~ s/\n/<br> /g;
+        $vars_info->{$_}{'description'} =~ s/\s\s+//g;
+        $vars_info->{$_}{'description'} =~ s/\<br>/\n/g;
 
+        print $vars_info->{$_}{'description'};
+        print "\n";
+        print "*" x 72, "\n";
+        if ( $vars_info->{$_}{'optional'} ) {
+            print
+"You may skip this section to get the default values\nDo you want to set them up? y/n [y] ";
+            chomp( my $ans = <> );
+            if ( $ans =~ /^\s*n/i ) {
+                setDefaults( @{ $vars_info->{$_}{'vars'} } );
+                next;
+            }
+            $vars_info->{$_}{'set'} = 1;
+        }
+        configure( @{ $vars_info->{$_}{'vars'} } );
+        system("clear");
+    }
+    write_config();
+}
 
 sub get_backup_timestamp {
-   unless ($INSTALL_TIMESTAMP) {
-      my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time); 
-      ++$mon;
-      $year+=1900;
-      $mon=($mon<10)?"0$mon":$mon;
-      $mday=($mday<10)?"0$mday":$mday;
-      $INSTALL_TIMESTAMP="$year.$mon.$mday\_$hour.$min.$sec";
-   }
-   return $INSTALL_TIMESTAMP;
+    unless ($INSTALL_TIMESTAMP) {
+        my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
+          localtime(time);
+        ++$mon;
+        $year += 1900;
+        $mon  = ( $mon < 10 )  ? "0$mon"  : $mon;
+        $mday = ( $mday < 10 ) ? "0$mday" : $mday;
+        $INSTALL_TIMESTAMP = "$year.$mon.$mday\_$hour.$min.$sec";
+    }
+    return $INSTALL_TIMESTAMP;
 }
 
 sub backup {
-   my $file=shift;
-   if (-e $file) {
-      print "File $file already exists\nMaking backup to ";
-      my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time); 
-      ++$mon;
-      $year+=1900;
-      $mon=($mon<10)?"0$mon":$mon;
-      $mday=($mday<10)?"0$mday":$mday;
-      
-      my $backup_timestamp=get_backup_timestamp();
-      my $backupfile= "$file-save-$backup_timestamp";
-      print "$backupfile\n";
-      system("cp $file $backupfile");
-      print "chmoding 0600 $backupfile\n";
-      system("chmod 0600 $backupfile");
-   }
-}
-
-
-
+    my $file = shift;
+    if ( -e $file ) {
+        print "File $file already exists\nMaking backup to ";
+        my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
+          localtime(time);
+        ++$mon;
+        $year += 1900;
+        $mon  = ( $mon < 10 )  ? "0$mon"  : $mon;
+        $mday = ( $mday < 10 ) ? "0$mday" : $mday;
 
+        my $backup_timestamp = get_backup_timestamp();
+        my $backupfile       = "$file-save-$backup_timestamp";
+        print "$backupfile\n";
+        system("cp $file $backupfile");
+        print "chmoding 0600 $backupfile\n";
+        system("chmod 0600 $backupfile");
+    }
+}
 
 &main();
 use Data::Dumper;
@@ -521,13 +508,12 @@
 print F Dumper($vars);
 print F "\n1;\n";
 
-
-print "\n\nConfiguration files have been created and are in the ./tmp directory.\n";
+print
+  "\n\nConfiguration files have been created and are in the ./tmp directory.\n";
 print "You may wish to examine them before installing further\n";
 
-
-END{
-   print "Enjoy!\n";
+END {
+    print "Enjoy!\n";
 }
 
 __END__



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.