#!/usr/bin/env perl # ---------------------------------------------------------------------- # This is the base startup script for SOFTWARE -- all versions, # all platforms. It sets some variables, figures out which version to # run, and invokes the startup script for that version. # # Variables Used Globally # $version Software Version Number (e.g. 6.07) # @args Command line args without athena additions # @not_available List of Platforms on which SOFTWARE # doesn't run # $sys (optional) value of $ATHENA_SYS # $swtoolsDir pointer to swtools locker in AFS # $msg_dir # ---------------------------------------------------------------------- $software = "java"; @not_available = (""); $base_locker = "/mit/${software}"; # added by alexp 4/12/06 written by zacheiss # to not wait for message send on backgrounded launch when zephyr not used $SIG{'TTOU'} = 'IGNORE'; $SIG{'TTIN'} = 'IGNORE'; &initialize ($base_locker); if (-s "/etc/athena/reactivate") { $isathena = "1"; } else { $isathena = "0"; $vermsg=`fs sysname`; chomp($vermsg); $q1=index($vermsg, "'"); $q2=index($vermsg,"'",$q1+1); $athenasys=substr($vermsg,$q1+1,$q2-$q1-1); if (! defined ($ENV{"ATHENA_SYS"})) { $ENV{"ATHENA_SYS"} = $athenasys; } $ENV{"PATH"} = "${base_locker}" . "/arch/" . $ENV{"ATHENA_SYS"} . "/bin:" . $ENV{"PATH"}; } $version = "1.8.0_172"; &process_local_args; # set @args, possibly $version $sw_version = "${software}_v${version}"; $version_locker = "/mit/${sw_version}"; #$cookie = "JDK1.6.0_13def_040109"; #&delete_cookie ($cookie); #sleep(2); #$cookie = "JDK1.6.0_16def_081809"; #$message = "$msg_dir/JDK160_16def"; #&delete_cookie ($cookie); #sleep(1); &exec_version ($version_locker, $sw_version, $version, $software); # ---------------------------------------------------------------------- # initialize # # Use this routine do any sort of initialization. Code is included # for setting a reasonable value for $ATHENA_SYS if that is needed. # # Globals Set # $sys - ATHENA_SYS environment variable # $msg_dir - Location of magic cookie files # $swtoolsDir - Location of the swtools locker # $redirection - Controls visibility of stdout from attach # # ---------------------------------------------------------------------- sub initialize { local ($base) = @_; # Uncomment this if you need to use $ATHENA_SYS if (! defined ($sys = $ENV{"ATHENA_SYS"})) { open (MACH, "machtype -S|"); chop ($sys = ); if (length ($sys) == 0) { $sys = "\@sys"; } close MACH; } $redirection = "> /dev/null"; # For messages launched from base locker $msg_dir = "${base}/Athena/messages"; $swtoolsDir="/afs/athena/software/swtools"; } # ---------------------------------------------------------------------- # process_local_args # # Process the command line arguments. We do this to search # for Athena-specific options, currently limited to a version # specification. # # Globals Referenced # @ARGV # # Globals Set # @args - Command line arguments without athena-specifc ones # # ---------------------------------------------------------------------- sub process_local_args { local ($arg, $verflag); # alexp 9/19/05 fixed to not stop prematurely if a command-line arg is "" $verflag = 0; foreach $argnum (0 .. $#ARGV) { ARGS: { $arg = $ARGV[$argnum]; # change to not match on -verbose, which is a javac option alexp 9/5/97 # further change to only match on -ver to avoid capture of -verify etc. # alexp 2/24/98 if ($arg =~ /^-ver$/) { $version = $ARGV[$argnum+1]; $verflag = 1; last ARGS; } if ($arg eq "-show_stdout") { $redirection = ""; last ARGS; } if ($verflag) { $verflag = 0; last ARGS; } push (@args, $arg); } } } # ---------------------------------------------------------------------- # exec_version # # This routine attaches the version-specific locker and execs # that startup script. # # ---------------------------------------------------------------------- sub exec_version { local ($version_locker, $sw_version, $version, $software) = @_; local ($pos, $program, $bindir); $pos = rindex ($0, "/") + 1; $program = substr ($0, $pos); if ($isathena) { system ("attach -q $sw_version") if ! (-e "$version_locker"); if (! -d "$version_locker") { print <); close BINDIR; $executable = "$bindir/$program"; if ( -e $executable) { exec ($executable, @args); # Should not get here exit 0; } else { print <