#{{PERL-EXEC}} use Getopt::Std; use File::Copy "cp"; use warnings; #use strict; sub usage { print (STDERR "Arguments:\n"); print (STDERR " -i - install\n"); print (STDERR " -u - uninstall\n"); print (STDERR " -p - optional dsml port, defaults to 8080\n\n"); exit 100; } # Process the command line arguments { usage() if (!getopts('uip:')); $DSMLPORT=8080; $DSMLPORT=$opt_p if ($opt_p); my $SERVERNAME = "{{SERVER-NAME}}"; my $SERVERROOT = "{{DS-ROOT}}"; my $PATH="{{SEP}}admin-serv{{SEP}}config{{SEP}}"; my @FILES= ( "server.xml", "web-apps.xml", "obj.conf", "jvm12.conf" ); die "-i or -u required" if (!($opt_i || $opt_u)); die "-i OR -u required" if ($opt_i && $opt_u); if ($opt_i) { if (-e "$SERVERROOT{{SEP}}clients{{SEP}}dsmlgw{{SEP}}dsmlgw.cfg" ) { print STDERR "leaving existing dsmlgw.cfg untouched.\n"; } else { open DSMLCFG, ">$SERVERROOT{{SEP}}clients{{SEP}}dsmlgw{{SEP}}dsmlgw.cfg"; select DSMLCFG; print "\#properties file for the Netscape DSMLGW\n\nServerHost=${SERVERNAME}\nServerPort={{SERVER-PORT}}\nBindDN=\nBindPW=\n\n"; print "MinLoginPool=1\nMaxLoginPool=2\nMinPool=3\nMaxPool=15\n"; close DSMLCFG; } open WEB, ">$SERVERROOT{{SEP}}clients{{SEP}}dsmlgw{{SEP}}WEB-INF{{SEP}}web.xml"; select WEB; print < Apache-Axis org.apache.axis.transport.http.AxisHTTPSessionListener AxisServlet Apache-Axis Servlet org.apache.axis.transport.http.AxisServlet AxisServlet /services/* 5 wsdl text/xml xsd text/xml index.html index.jsp index.jws EOF close WEB; } foreach $file (@FILES) { if ($opt_u) { # restore from backups print STDOUT "${file}.bak -> ${file}\n"; rename("${SERVERROOT}${PATH}${file}.bak","${SERVERROOT}${PATH}${file}"); } if ($opt_i) { # make backups print STDOUT "${file} -> ${file}.bak\n"; cp("${SERVERROOT}${PATH}${file}","${SERVERROOT}${PATH}${file}.bak"); if ( $file eq "server.xml") { open SERVER, "${SERVERROOT}${PATH}${file}" || die("Could not open file!"); @raw_data=; close SERVER; $i=0; while ($line = $raw_data[$i++]) { #if ($line =~ /CONNECTIONGROUP.*servername=\"([\w.?]+)\"/ ){ #$SERVERNAME = $1; #} if ($line =~ /\<\/LS/ ) { splice @raw_data, $i++,0, (" \n", " \n" ); $i+=2; } if ($line =~ /\<\/VSCLASS/ ) { splice @raw_data, $i, 0, (" \n" . "\n" . " \n" . " \n \n \n"); $i++; } } open SERVER, "> ${SERVERROOT}${PATH}${file}" || die("Could not open file!"); select SERVER; print @raw_data; close SERVER; } if ( $file eq "web-apps.xml" ) { open WEBAPPS, "> ${SERVERROOT}${PATH}${file}"; select WEBAPPS; print STDERR "adding necessary entry to $file.\n"; print < EOF close WEBAPPS; } if ( $file eq "obj.conf" ) { open OBJ, ">> ${SERVERROOT}${PATH}${file}"; select OBJ; print STDERR "adding necessary entry to $file.\n"; print < ObjectType fn=type-by-extension ObjectType fn=force-type type=text/plain Service fn="NSServletService" type="magnus-internal/servlet" Service method=(GET|HEAD|POST) type=*~magnus-internal/* fn=send-file Error fn="admin-error" reason="server error" AddLog fn="admin40_flex_log" name="access" NameTrans fn="NSServletNameTrans" name="servlet" PathCheck fn=find-pathinfo PathCheck fn=find-index index-names="index.html,home.html" Service type="magnus-internal/jsp" fn="NSServletService" EOF close OBJ; } if ( $file eq "jvm12.conf" ) { open JVM, ">> ${SERVERROOT}${PATH}${file}"; select JVM; print STDERR "adding necessary entry to $file.\n"; print "jvm.option=-Duser.home=${SERVERROOT}{{SEP}}clients{{SEP}}dsmlgw"; close JVM; } } } }