File:  [CSRG BSD Unix] / 43BSDReno / contrib / isode-beta / others / quipu / tools / scripts / aei2dsa
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:56 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43reno
BSD 4.3reno

#!/bin/sh
awk '
BEGIN {
	default["iso ftam"]		= "#259/"
	default["iso vt"]		= "#260/"
	default["iso cmip"]		= "#261/"
	default["isode miscellany"]	= "#518/"
	default["isode shell"]		= "#524/"
	default["isode idist"]		= "#525/"

	print  "#!/bin/sh"
}
{
	if ( substr($0,1,1) == "#" )
		next
	if ( $1 == "" )
		next

	tmp = $2
	for (i=3; i<=NF-1; i++)
		tmp = tmp " " $i

	if ( last != $1 ) {
		last = $1
		dn = "\"cn=" $1 "\""
		print "if ( showname " dn " 1>/dev/null 2>&1 )\nthen"
		print 	"\techo " dn "..."
		print "else"
		print 	"\techo \"objectClass=applicationProcess & quipuObject\" > /tmp/aet$$"
		print 	"\tadd \"cn=" $1 "\" -draft /tmp/aet$$ -noedit" 
		print "fi\n"
	}

	if ( $2 == "default" ) {
		print "# Adding default services"

		for (i in default) {
			dn = "\"cn=" last "@cn=" i "\""
			print "if ( showentry " dn " -edb -all > /tmp/zaet$$ 2>/dev/null )\nthen"
			print 	"\tsed \"s@presentationAddress= .*@presentationAddress= " default[i] $NF "@\" <>/tmp/zaet$$ >/tmp/aet$$ "
			print 	"\tmodify " dn " -draft /tmp/aet$$ -noedit" 
			print 	"\trm -f /tmp/zaet$$"
			print "else"
			print 	"\techo \"supportedApplicationContext=" i "\" > /tmp/aet$$"
			print 	"\techo '\''presentationAddress=" default[i] $NF "'\'' >> /tmp/aet$$"
			print 	"\techo \"objectClass=applicationEntity & quipuObject\" >> /tmp/aet$$"
			print 	"\tadd " dn " -draft /tmp/aet$$ -noedit" 
			print "fi"
		}
	} else {
		print "# Adding named service"
		dn = "\"cn=" last "@cn=" tmp "\""
		print "if ( showentry " dn " -edb -all > /tmp/zaet$$ 2>/dev/null )\nthen"
		print 	"\tsed \"s@presentationAddress= .*@presentationAddress= " $NF "@\" <>/tmp/zaet$$ >/tmp/aet$$ "
		print 	"\tmodify " dn " -draft /tmp/aet$$ -noedit" 
		print 	"\trm -f /tmp/zaet$$"
		print "else"
		print 	"\techo \"supportedApplicationContext=" tmp "\" > /tmp/aet$$"
		print 	"\techo '\''presentationAddress=" $NF "'\'' >> /tmp/aet$$"
		print 	"\techo \"objectClass=applicationEntity & quipuObject\" >> /tmp/aet$$"
		print 	"\tadd " dn " -draft /tmp/aet$$ -noedit" 
		print "fi\n"
	}

}
END {
	print "rm -f /tmp/aet$$"
} ' 


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.