#!/bin/sh # assumptions # 1. we are bound with sufficient access rights (e.g manager) # 2. we are positioned at the right part of the DIT sed 's/ */ /g s/ :/:/g s/\&/\\&/g' < quipuentities | awk -F: ' BEGIN { print "#!/bin/sh" } { if ( substr($0,1,1) == "#" ) next if ( $1 == "" ) next if ( last != $1 ) { last = $1 dn = "\"cn=" $1 "\"" print "if ( showname " dn " 1>/dev/null 2>&1 )\nthen" print "\techo " $1 "..." print "else" print "\techo \"objectClass=applicationProcess & quipuObject\" > /tmp/aet$$" print "\tadd \"cn=" $1 "\" -draft /tmp/aet$$ -noedit" print "fi\n" } print "echo \" " $2 "...\"" dn = "\"cn=" last "@cn=" $2 "\"" print "if ( showentry " dn " -edb -all > /tmp/zaet$$ 2>/dev/null )\nthen" print "\tsed \"s@supportedApplicationContext=.*@supportedApplicationContext= " $3 "@\" </tmp/zaet$$ |\\" print "\tsed \"s@presentationAddress=.*@presentationAddress= " $4 "@\" |\\" print "\tsed \"s@execVector=.*@execVector= " $5 "@\" >/tmp/aet$$ " if ( $5 != "" ) print "\techo \"objectClass=isodeapplicationEntity & quipuObject\" >> /tmp/aet$$" print "\tmodify " dn " -draft /tmp/aet$$ -noedit 2>&1 | sed '\''s/The draft.*/ No Change/\ns/are exactly.*//'\''" print "\trm -f /tmp/zaet$$" print "else" print "\techo \"supportedApplicationContext=" $3 "\" > /tmp/aet$$" print "\techo '\''presentationAddress=" $4 "'\'' >> /tmp/aet$$" if ( $5 == "" ) print "\techo \"objectClass=applicationEntity &quipuObject\" >> /tmp/aet$$" else { print "\techo '\''execVector=" $5 "'\'' >> /tmp/aet$$" print "\techo \"objectClass=isodeapplicationEntity & quipuObject\" >> /tmp/aet$$" } print "\tadd " dn " -draft /tmp/aet$$ -noedit" print "fi\n" } END { print "rm -f /tmp/aet$$" } '