4 Usage $0 mapname base < mapfile >mapfile.ldif
6 mapname: name of the amd map beeing converted to ldif
7 base : The LDAP search base. Do not forget the quotes!
9 This script should/could be used in a Makefile together
10 with ldif2ldbm(8C) to automagically update the ldap
11 databases and restart slapd whenever a master copy of
12 the maps have changed. Remember "cd /var/yp; make" ?
15 my $fmt = "%-12s: %s\n";
16 my $tfmt = "%-15s: %s\n";
17 my $mapname = $ARGV[0] or die $usage;
18 my $base = $ARGV[1] or die $usage;
21 print "dn: cn=amdmap timestamp, $base\n";
22 printf "$tfmt", "cn", "amdmap timestamp";
23 printf "$tfmt", "objectClass", "amdmapTimestamp";
24 printf "$tfmt", "amdmapTimestamp", $time;
45 my @vals = split(/\s+/,$line);
46 my $key = shift @vals;
49 print "dn: cn=amdmap $mapname\[$key\], $base\n";
50 printf "$fmt","cn","amdmap $mapname\[$key\]";
51 printf "$fmt","objectClass", "amdmap";
52 printf "$fmt","amdmapName", $mapname;
53 printf "$fmt","amdmapKey", $key;
54 printf "$fmt","amdmapValue", join(' ',@vals);
56 $line = ""; $done = 0;