Thanks! I've added a link to this script on the
http://directory.fedora.redhat.com/wiki/Howto:OpenLDAPMigration page.
Mike Jackson wrote:
Nathan Benson
wrote:
i have a quick and dirty perl script i had
cooked up to do this. it was
enough to allow me to convert some openldap schema to FDS. i was able
to successfully start FDS after converting a few of them (samba3, etc).
And here is the one which I promised. It does OL schema to LDIF
conversion, as well as pretty printing for readability.
usage: ./ol-schema-migrate.pl nis.schema > nis.ldif
Sorry, I couldn't think of a better name for the script. Let me know
(on the list) if there are any problems with it and I'll fix them.
--
mike
#!/usr/bin/perl -w
#
# Convert OpenLDAP schema files into RHDS format with pretty printing
#
# Mike Jackson <mj@xxxxxx> 14 June 2005
#
# GPL license
#
use strict;
my @lines = <>;
my @at;
my @oc;
my $at = 0;
my $oc = 0;
my $at_string;
my $oc_string;
for (@lines) {
if ($at) {
s/\n//;
s/ +/ /;
s/\t/ /;
$at_string .= $_;
if ( /\)$/ ) {
push @at, $at_string;
$at = 0;
$at_string = "";
}
}
if ($oc) {
s/ +/ /;
s/\t/ /;
$oc_string .= $_;
if ( /^\n/ ) {
$oc_string =~ s/\n//;
push @oc, $oc_string;
$oc = 0;
$oc_string = "";
}
$oc_string =~ s/\n//;
}
if ( /attribute[t|T]ype/ ) {
$at = 1;
s/\n//;
s/attribute[t|T]ype/attributeTypes:/;
$at_string .= $_;
}
if ( /object[c|C]lass/ ) {
$oc = 1;
s/\n//;
s/object[c|C]lass/objectClasses:/;
$oc_string .= $_;
}
}
&seperator;
print "dn: cn=schema\n";
&seperator;
for (@at) {
s/attributeTypes: \(/attributeTypes: \(\n /;
s/NAME/\n NAME/;
s/EQUALITY/\n EQUALITY/;
s/SUBSTRING/\n SUBSTRING/;
s/DESC/\n DESC/;
s/SYNTAX/\n SYNTAX/;
s/SUP/\n SUP/;
s/SUBSTR/\n SUBSTR/;
s/SINGLE-VALUE/\n SINGLE-VALUE/;
s/\)$/\n )/;
s/ \n/\n/g;
print "$_\n";
&seperator;
}
for (@oc) {
s/objectClasses: \(/objectClasses: \(\n /;
s/NAME/\n NAME/;
s/SUP/\n SUP/;
s/AUXILIARY/\n AUXILIARY/;
s/STRUCTURAL/\n STRUCTURAL/;
s/DESC/\n DESC/;
s/MUST/\n MUST/;
s/MAY/\n MAY/;
s/\)$/\n )/;
s/ \n/\n/g;
print "$_\n";
&seperator;
}
## subs
sub seperator {
print "#\n";
print "#********************************************************************\n";
print "#\n";
}
--
Fedora-directory-users mailing list
Fedora-directory-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-directory-users
|
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
--
Fedora-directory-users mailing list
Fedora-directory-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-directory-users