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 $mapname timestamp, $base\n";
22 printf "$tfmt", "cn", "amdmap $mapname timestamp";
23 printf "$tfmt", "objectClass", "amdmapTimestamp";
24 printf "$tfmt", "amdmapName", "$mapname";
25 printf "$tfmt", "amdmapTimestamp", $time;
26 printf "$tfmt", "amdmapName", $mapname;
47 my @vals = split(/\s+/,$line);
48 my $key = shift @vals;
51 print "dn: cn=amdmap $mapname\[$key\], $base\n";
52 printf "$fmt","cn","amdmap $mapname\[$key\]";
53 printf "$fmt","objectClass", "amdmap";
54 printf "$fmt","amdmapName", $mapname;
55 printf "$fmt","amdmapKey", $key;
56 printf "$fmt","amdmapValue", join(' ',@vals);
58 $line = ""; $done = 0;