Skip to content

Instantly share code, notes, and snippets.

@hiroyuki-sato
Created December 14, 2012 06:53
Show Gist options
  • Save hiroyuki-sato/4283247 to your computer and use it in GitHub Desktop.
Save hiroyuki-sato/4283247 to your computer and use it in GitHub Desktop.
Convert OpenDS Schema file to openldap schema
#!/usr/bin/ruby -w
print <<EOF
dn: cn={99}openam
objectClass: olcSchemaConfig
cn: {99}openam
EOF
idx = {
"attributeTypes" => 1,
"objectClasses" => 1
}
while ( line = ARGF.gets )
line.chomp!
if( line =~ /attributeTypes:\s+(.*)/ )
v = $1
i = idx["attributeTypes"];
puts "olcAttributeTypes: {#{i}}#{v}"
i = idx["attributeTypes"] += 1
elsif( line =~ /objectClasses:\s+(.*)/ )
v = $1
i = idx["objectClasses"];
puts "olcObjectClasses: {#{i}}#{v}"
i = idx["objectClasses"] += 1
else
# do nothing
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment