#!/usr/bin/env perl ########################################################################### # # This is condor_install. It should be run to install and configure # Condor on a given machine. It can be run to customize a given # release directory, to initialize Condor on the local host, or to # initialize Condor for many hosts (if run on a file server). # # Please read the INSTALL file or the Installation chapter of the # Condor Administrator's Manual. # # You shouldn't need to edit this script at all. # # condor_install by Derek Wright 2/19/98 # ########################################################################### # Set some global settings umask 0022; # Initialize some global variables: @tool_names=("checkpoint", "off", "on", "reconfig", "reconfig_schedd", "reschedule", "restart", "vacate" ); @bin_names=( "q", "rm", "submit", "status", "prio", "userprio", "compile", "history", "config_val", "findhost", "release", "run", "userlog", "version" ); @full_lib_names=( "ld", "libcondorc++support.a", "condor_rt0.o", "libcondorsyscall.a" ); @sbin_master_names=( "master", "preen" ); $needs_lock=0; $fs_domain=""; $uid_domain=""; $soft_uid=""; $java_jvm_path=""; $java_jvm_maxmem_arg=""; # Print the opening remarks: print "\n" x 50, "Welcome to condor_install. You are going to need to answer a few\n", "questions about how you want Condor configured on this machine, what\n", "pool(s) you want to join, and if this is machine is going to serve as\n", "the Central Manager for its own pool. If you are unsure about how to\n", "answer any of the questions asked here, please consult the INSTALL\n", "file or the Installation chapter of the Condor Administrator's Manual.\n", "\n", "The installation is broken down into various steps. Please consult the\n", "INSTALL file to refer to a specific step if you have trouble with it.\n", "\n", "For most questions, defaults will be given in []'s. To accept the\n", "default, just press return.\n", "\n", "If you have problems installing or using Condor, please consult the\n", "Condor Administrator's Manual, which is can be found on the World Wide\n", "Web at: http://www.cs.wisc.edu/condor/manual/\n", "If you still have problems, send email to condor-admin\@cs.wisc.edu.\n\n", "Press enter to begin Condor installation\n"; $_ = ; ### Figure out who and where we are: @pwdent = getpwuid($<); $who=$pwdent[0]; $tilde=$pwdent[7]; chop($host=`hostname`); # Make sure $host is just hostname, with no domain. Grab everything # upto the first ".". $host =~ s/(\w*)\..*/$1/; # Lookup the full hostname. $fullhost=(gethostbyname($host))[0]; if( ! ($fullhost =~ /.*\..*/) ) { # There's no "." in the hostname. DNS/hosts/YP is probably # misconfigured... try the other entry, that might be it. $fullhost=(gethostbyname($host))[1]; } if( ! ($fullhost =~ /.*\..*/) ) { # There's still no "." in the hostname. DNS/hosts/YP is totally # misconfigured... prompt the user; $fullhost=&prompt_fullhost(); } # Grab just the domain, so we have it. $fullhost =~ /\w*\.(.*)/; $domain = $1; ### Find condor's home directory, if it exists. @pwdent = getpwnam( "condor" ); $condor_home=$pwdent[7]; $condor_uid=$pwdent[2]; ### Figure out who should own the files we create. $owner = &find_owner(); ### Figure out what we should do: print "\n***************************************************************************\n", "\tSTEP 1: What type of Condor installation do you want?\n", "***************************************************************************\n"; @install_type = &prompt_install_type(); if( ! @install_type ) { print "\nI have nothing to do. Exiting.\n"; exit(1); } print "\nPress enter to continue. "; $_ = ; print "\n***************************************************************************\n", "\tSTEP 2: How many machines are you setting up for Condor?\n", "***************************************************************************\n"; if( grep(/central_manager/, @install_type) ) { print "\nYou can only have 1 machine set up as a central manager.\n"; } else { @machines = &prompt_multi_machines(); } print "\nPress enter to continue. "; $_ = ; print "\n***************************************************************************\n", "\tSTEP 3: Install the Condor \"release directory\", which holds\n", "\tvarious binaries, libraries, scripts and files used by Condor.\n", "***************************************************************************\n"; $release_dir = &install_release_dir(); print "\nUsing $release_dir as the Condor release directory.\n", "\nPress enter to continue. "; $_ = ; ### Do what we need to do: if( grep(/submit/, @install_type) ) { ### Only need to prompt for mail settings for full-install or submit-only print "\n***************************************************************************\n", "\tSTEP 4: How and where should Condor send email if things go wrong?\n", "***************************************************************************\n"; &prompt_mail_settings(); print "\nUsing $mail_path to send email to $condor_admin\n", "\nPress enter to continue. "; $_ = ; ### Only need to prompt for domain settings for full-install or submit-only print "\n***************************************************************************\n", "\tSTEP 5: Filesystem and UID domains.\n", "***************************************************************************\n"; &prompt_domain_settings(); print "\nPress enter to continue. "; $_ = ; if( grep(/execute/, @install_type) ) { &configure_full_install(); } else { &configure_submit_only(); } } elsif( grep(/central_manager/, @install_type) ) { # If we're just doing CM, can skip step 4, etc. &configure_central_manager(); } ########################################################################### # Subroutines: ########################################################################### sub find_owner { local( $owner ); if( $< ) { # Non-root return $<; } # We're root, see who should own the Condor files/directories $_=$ENV{CONDOR_IDS}; if( $_ ) { s/(\d*)\.\d*/$1/; $owner = $_; @pwdent = getpwuid($owner); if( ! $pwdent[0] ) { print "\nuid specified in CONDOR_IDS ($owner) is not valid. Please ", "set the\nCONDOR_IDS environment variable to the uid.gid pair ", "that Condor\nshould use.\n\n"; exit(1); } } elsif( $condor_uid ) { $owner = $condor_uid; } else { print "There's no \"condor\" account on this machine and the CONDOR_IDS ", "environment\nvariable is not set. Please create a condor account, or ", "set the CONDOR_IDS\nenvironment variable to the uid.gid pair that ", "Condor should use.\n"; exit(1); } return $owner; } sub prompt_multi_machines { local( @machines ); print "\nAre you planning to setup Condor on multiple machines? [yes] "; chop( $_ = ); if( ! /(^[Yy].*)|^$/ ) { return @machines; } print "Will all the machines share files via a file server? [yes] "; chop( $_ = ); if( /(^[Yy].*)|^$/ ) { print "\nYou should run condor_install on your file server, so that ", "root has\npermission to create files needed by Condor.\n"; } else { print "\nYou will need to run condor_install locally on each ", "machine.\nSetting up host \"$host\" for Condor.\n"; return @machines; } print "\n", "What are the hostnames of the machines you wish to setup?\n", "(Just type the hostnames, not the fully qualified names.\n", "Put one machine per line. When you are done, just hit enter.)\n"; while( chop($_ = ) ) { if( /^.*\/.*/ ) { # Contains '/', try to open it and read: print "Don't know how to read from a file yet.\n"; } elsif (/^$/ ) { last; } else { # strip off any whitespace s/\s//g; push( @machines, $_ ); } } print "Setting up Condor for the following machines:\n", "@machines\n"; return @machines; } sub prompt_install_type { local( @type ); if( $_ = &prompt_full_install() ) { push( @type, ("submit", "execute") ); } elsif( $_ = &prompt_submit_only() ) { push( @type, "submit" ); } elsif( $_ = &prompt_install_central_manager() ) { push( @type, "central_manager" ); } return @type; } sub prompt_submit_only { if( @machines ) { print "\nWould you like to setup these hosts as submit-only machines? [yes] "; } else { print "\nWould you like to setup this host as a submit-only machine? [yes] "; } $_ = ; /(^[Yy].*)|^$/; } sub prompt_install_central_manager { print "\nWould you like to setup this host as a Condor Central Manager?\n", "(Only choose this option if you have already done a full installation on\n", "a file server and want to setup the local machine [no] "; $_ = ; /^[Yy].*/; } sub prompt_full_install { print "\nWould you like to do a full installation of Condor? [yes] "; $_ = ; /(^[Yy].*)|^$/; } sub configure_submit_only { local( $pool, $config_file, $path, %pool_config_file ); print "\n***************************************************************************\n", "\tSTEP 6: Where should public programs be installed?\n", "***************************************************************************\n"; print "\n", "When I'm done, I'm going to need to install some scripts and links.\n", "I can either install these files into a directory that is already in\n", "your PATH that you have write access to, or I can put them into any\n", "directory you specify (in which case you would have to add that\n", "directory to your PATH or explicitly use a full pathname to access the\n", "Condor tools).\n"; $path = &prompt_install_path(); $root_dir = &prompt_root_dir(); @pools = &prompt_pools(); if( $pools[0] ) { $default_pool = $pools[0]; print "\nSetting up for the following pools: @pools\n", "Using \"$default_pool\" as the default pool.\n"; foreach $pool (@pools) { print "\n---------------------------------------------------------------------------\n", "Configuring pool: $pool\n", "---------------------------------------------------------------------------\n"; $config_file = &configure_pool($pool); $pool_config_file{$pool} = $config_file; } } else { print "\n---------------------------------------------------------------------------\n", "Setting up for a single pool.\n", "---------------------------------------------------------------------------\n"; $config_file = &configure_pool(""); $pool_config_file{"default"} = $config_file; push( @pools, "default" ); } &customize_condor_script( *pools, *pool_config_file, ); } sub customize_condor_script { local( *pool_ref, *conf_ref ) = @_; local( $def_pool, $pool, $tool ); $def_pool = $pool_ref[0]; print "\nCustomizing the \"condor\" script ... "; open( GENERIC, "<$release_dir/etc/examples/condor.generic" ) || die "\nCan't open generic condor script: $release_dir/etc/examples/condor.generic\n"; open( CONDOR, ">$path/condor" ) || die "\nCan't open condor script: $path/condor\n"; while( ) { SWITCH: { if( /^\$default_pool.*$/ ) { print CONDOR "\$default_pool=\"$def_pool\";\n"; last SWITCH; } if( /^\$release_dir.*$/ ) { print CONDOR "\$release_dir=\"$release_dir\";\n"; last SWITCH; } if( /^\%configlocation.*$/ ) { print CONDOR $_; foreach $pool (@pool_ref) { print CONDOR "\t\"$pool\",\t\"$conf_ref{$pool}\",\n"; } last SWITCH; } print CONDOR $_; } } close CONDOR; close GENERIC; chmod( 0755, "$path/condor" ) || die "\nCan't chmod $path/condor: $!\n"; print "\nCreated $path/condor.\n"; foreach $tool ( "master", @bin_names, @tool_names ) { if( -f "$path/condor_$tool" ) { unlink "$path/condor_$tool" || die "Can't remove $path/condor_$tool: $!\n"; } link( "$path/condor", "$path/condor_$tool" ) || die "Can't create link: $path/condor_$tool: $!\n"; } } sub prompt_root_dir { local( $dir ); print "\nCondor needs to create some directories for its own use. Where would\n"; print "you like to put these directories?\n[$tilde/condor] "; chop( $_ = ); if( /^$/ ) { $dir = "$tilde/condor"; } else { $dir = $_; } if( ! -d $dir ) { print "$dir does not exist, shall I create it now? [yes] "; chop( $_ = ); if( /(^[Yy].*)|^$/ ) { if( ! mkdir($dir, 0777) ) { print "I can't create \"$dir\", try again.\n"; return &prompt_root_dir(); } } else { print "I've got to create a directory for Condor to work, try again.\n"; return &prompt_root_dir(); } } if( @machines ) { print "\nIs $dir shared by all the machines\nyou are setting up? [yes] "; $_ = ; if( ! /(^[Yy].*)|^$/ ) { print "\nYou're going to have to run condor_install on each machine if ", "you use\n$dir. Do you still want to use it? [no] "; $_ = ; if( /^y.*/i ) { @machines = (); } else { return &prompt_root_dir(); } } } return $dir; } sub prompt_central_manager { local( $submit ) = @_; local( $cm ); while(1) { print "\nWhat is the full hostname of the central manager?\n"; if( $submit ) { print "(condor.cs.wisc.edu is the central manager for the UW-Madison ", "Computer\nScience Department Condor pool.) [condor.cs.wisc.edu]\n"; } else { print "[$fullhost] "; } chop( $_ = ); if( /^$/ ) { if( $submit ) { $cm = "condor.cs.wisc.edu"; } else { $cm = $fullhost; } } else { $cm = $_; } # Try to ping the machine #print "Making sure I can talk to host \"$cm\" ... "; #if( ! pingecho($cm, 10) ) { # print "\nI can't ping \"$cm\", do you still want to use it? [no] "; # chop( $_ = ); # if( /^[Yy].*/ ) { # last; # } #} else { # print "success.\n"; # last; #} # Try to lookup what we were told with DNS: if( (gethostbyname($cm))[0] ) { last; } else { print "\nI can't find host information for $cm from a nameserver.\n", "Do you still want to use it? [no] "; chop( $_ = ); if( /^[Yy].*/ ) { last; } } } return $cm; } sub prompt_pool_dir { local( $pool ) = @_; local( $pool_dir ); while(1) { $pool_dir = "$root_dir/$pool"; print "\nFor each pool you are going to join, Condor will need ", "a seperate directory.\nWhere do you want this pool-specific ", "directory?\n[$pool_dir] "; chop( $_ = ); if( ! /^$/ ) { $pool_dir = $_; } if( -d $pool_dir ) { last; } else { print "\"$pool_dir\" doesn't exist, should I create it now? [yes] "; chop( $_ = ); if( /(^[Yy].*)|^$/ ) { if( ! mkdir($pool_dir, 0777) ) { print "I can't create \"$pool_dir\", try again.\n"; } else { last; } } else { print "I've got to have a pool-specific directory, try again.\n"; } } } return $pool_dir; } sub prompt_global_config_file { local( $dir ) = @_; local( $config_file ); while(1) { print "\nWhere do you want to put Condor's configuration file ", "for this pool?\n[$dir/etc/condor_config] "; chop( $_ = ); if( /^$/ ) { -d "$dir/etc" || mkdir("$dir/etc", 0777) || die "Can't create \"$dir/etc\"\n"; $config_file = "$dir/etc/condor_config"; } else { $config_file = $_; } if( system("touch", "$config_file") ) { print "I can't create \"$config_file\", try again.\n"; } else { last; } } return $config_file; } sub prompt_pool_user_name { local( $name ); print "\nWhat name do you want to use for your schedd in this pool?\n", "(If you don't understand this question, just accept the default.)\n", "[$who\@$fullhost] "; chop( $_ = ); if( /^$/ ) { $name = "$who"; } elsif( ! /^.*\@.*$/ ) { # There's no '@' in the name, we're in good shape. $name = $_; } else { # There's a '@' in the name, trim it off. s/^(.*)\@(.*)$/$1/; $name = $_; } return $name; } sub configure_pool { local( $pool ) = @_; local( $cm, $pool_dir, $local_dir_str, $config_file, $mach, $local_config_str, $local_config_dir, $name, $lock, @args ); # Initialize the local_config_str so that if we don't set it, # we'll have a null string by default. $local_config_str = ""; # Figure out the central manager. $cm = &prompt_central_manager( 1 ); # Figure out where the files should go for this pool. if( $pool ) { $pool_dir = &prompt_pool_dir( $pool ); } else { $pool_dir = $root_dir; } $config_file = &prompt_global_config_file( $pool_dir ); $name = &prompt_pool_user_name(); if( @machines ) { print "\nEach machine you want to add to this pool will need ", "its own directory.\nI'm going to name them by hostname and put them ", "in $pool_dir.\n(for example: \"$pool_dir/$host\")\n", "Is this ok? (You _REALLY_ want to say yes) [yes] "; chop( $_ = ); if( ! /(^[Yy].*)|^$/ ) { print "\nSo, you want to make trouble, eh? Ok, I give up. ", "Install things yourself!\n\n"; exit(1); } foreach $mach (@machines) { &condor_init( "$pool_dir/$mach", "log", "spool" ); } $local_dir_str = "$pool_dir/\$(HOSTNAME)"; $local_config_str = &prompt_local_config_file( $pool_dir, $pool_dir, 1, 0 ); $needs_lock = 1; } else { # Single machine $local_dir_str = "$pool_dir"; &condor_init( $pool_dir, "log", "spool" ); } $lock = &find_lock_dir(); @args=( $config_file, "$release_dir/etc/examples/condor_config.submit.generic", $cm, $local_dir_str, $local_config_str, $lock, $name ); &customize_config_file( @args ); return( $config_file ); } sub prompt_local_config_file { local( $local_config_dir ); local( $pool_dir, $local_dir, $has_mach, $force ) = @_; print "\nCondor allows you to have a machine-specific config file ", "that overrides\nsettings in the global config file.\n"; if( ! $force ) { print "\nDo you want to use a machine-specific config file? [yes] "; chop( $_ = ); if( ! /(^[Yy].*)|^$/ ) { return ""; } } else { print "\nYou must specify a machine-specific config file.\n"; } while( 1 ) { if( @machines ) { print "\nDo you want all the machine-specific config files for ", "each host in one\ndirectory? [yes] "; chop( $_ = ); if( /(^[Yy].*)|^$/ ) { while(1) { print "What directory should I use? [$pool_dir/etc] "; chop( $_ = ); if( /^$/ ) { $local_config_dir = "$pool_dir/etc"; } else { $local_config_dir = $_; } if( ! -d $local_config_dir ) { print "\"$local_config_dir\" doesn't exist, should ", "I create it? [yes] "; chop( $_ = ); if( /(^[Yy].*)|^$/ ) { if( ! mkdir($local_config_dir, 0777) ) { print "I can't create \"$local_config_dir\", ", "try again.\n"; } else { last; } } } else { last; } } print "\nNaming each config file [hostname].local\n", "Creating config files in \"$local_config_dir\" ... "; foreach $mach (@machines) { system( "touch $local_config_dir/$mach.local") && die "\nCan't create \"$local_config_dir/$mach.local\"\n"; } print "done.\n"; return "$local_config_dir/\$(HOSTNAME).local"; } print "\nShould I put a \"condor_config.local\" file in each machine's ", "local\ndirectory? [yes] "; } else { print "\nShould I put a \"condor_config.local\" file in $local_dir?\n[yes] "; } chop( $_ = ); if( /(^[Yy].*)|^$/ ) { print "Creating config files in \"$local_dir\" ... "; if( $has_mach ) { foreach $mach (@machines) { system( "touch", "$local_dir/$mach/condor_config.local") && die "\nCan't create \"$local_dir/$mach/condor_config.local\"\n"; } } else { system( "touch", "$local_dir/condor_config.local") && die "\nCan't create \"$local_dir/condor_config.local\"\n"; } print "done.\n"; return "\$(LOCAL_DIR)/condor_config.local"; } if( $force ) { print "\nYou have to have a local config file, please choose one of the", "\noptions I presented.\n"; print "\nPress enter to continue. "; $_ = ; } else { print "\nI'm going to assume, therefore, that you don't want a ", "machine-specific\nconfig file.\n"; return ""; } } } sub condor_init { local( $local_dir ) = $_[0]; shift; (-d "$local_dir") || mkdir("$local_dir", 0777) || die "\nCan't create \"$local_dir\"\n\n"; foreach $_ (@_) { (-d "$local_dir/$_") || mkdir("$local_dir/$_", 0777) || die "\nCan't create \"$local_dir/$_\"\n\n"; if( $owner != $< ) { chown($owner, -1, "$local_dir/$_") || die "\nCan't chown $local_dir/$_\n\n"; } } } sub customize_config_file { local( $config_file, $generic_file, $cm, $local_dir_str, $local_config_str, $lock, $name ) = @_; local( $ckpt, $view ); open( CONFIG, ">$config_file" ) || die "Can't open config file $config_file: $!\n"; open( GENERIC, "<$generic_file" ) || die "Can't open generic config file $generic_file: $!\n"; if( $cm eq "condor.cs.wisc.edu" ) { $ckpt = "condor-ckpt.cs.wisc.edu"; $view = "condor-view.cs.wisc.edu"; } print "\nConfiguring global condor config file ... "; while( ) { SWITCH: { if( /^CONDOR_HOST.*$/ ) { $_ = "CONDOR_HOST\t\t= $cm\n"; last SWITCH; } if( /^RELEASE_DIR.*$/ ) { $_ = "RELEASE_DIR\t\t= $release_dir\n"; last SWITCH; } if( /^LOCAL_DIR.*$/ ) { $_ = "LOCAL_DIR\t\t= $local_dir_str\n"; last SWITCH; } if( /^LOCAL[^_A-Za-z0-9]*$/ ) { if( $local_config_str ) { $_ = "LOCAL\t\t= $local_config_str\n"; } else { $_ = "#LOCAL\t\t= \$(LOCAL_DIR)/condor_config.local\n"; } last SWITCH; } if( /^CONDOR_ADMIN.*$/ ) { $_ = "CONDOR_ADMIN\t\t= $condor_admin\n"; last SWITCH; } if( /^MAIL.*$/ ) { $_ = "MAIL\t\t\t= $mail_path\n"; last SWITCH; } if( /^JAVA[^_A-Za-z0-9]/ ) { $_ = "JAVA\t= $java_jvm_path\n"; last SWITCH; } if( /^JAVA_MAXHEAP_ARGUMENT[^_A-Za-z0-9]/ ) { $_ = "JAVA_MAXHEAP_ARGUMENT\t= $java_jvm_maxmem_arg\n"; last SWITCH; } if( $lock && /^LOCK.*$/ ) { $_ = "LOCK\t\t\t= $lock\n"; last SWITCH; } if( $ckpt && /^#USE_CKPT_SERVER.*$/ ) { $_ = "USE_CKPT_SERVER\t\t= True\n"; last SWITCH; } if( $ckpt && /^#CKPT_SERVER_HOST.*$/ ) { $_ = "CKPT_SERVER_HOST\t= $ckpt\n"; last SWITCH; } if( $name && /^#MASTER_NAME.*$/ ) { $_ = "MASTER_NAME\t= $name\@\$(FULL_HOSTNAME)\n"; last SWITCH; } if( $name && /^#SCHEDD_NAME.*$/ ) { $_ = "SCHEDD_NAME\t= $name\@\$(FULL_HOSTNAME)\n"; last SWITCH; } if( $view && /^#CONDOR_VIEW_HOST.*$/ ) { $_ = "CONDOR_VIEW_HOST\t= $view\n"; last SWITCH; } if( $soft_uid && /^#SOFT_UID_DOMAIN.*$/ ) { $_ = "SOFT_UID_DOMAIN\t= $soft_uid\n"; last SWITCH; } if( $uid_domain && /^UID_DOMAIN.*$/ ) { $_ = "UID_DOMAIN\t= $uid_domain\n"; last SWITCH; } if( $fs_domain && /^FILESYSTEM_DOMAIN.*$/ ) { $_ = "FILESYSTEM_DOMAIN\t= $fs_domain\n"; last SWITCH; } } print CONFIG "$_"; } print "done.\n"; print "Created $config_file.\n"; close CONFIG; close GENERIC; } sub prompt_mail_settings { local( $def_mail_path ); print "\nIf something goes wrong with Condor, who should get email ", "about it?\n[$who\@$fullhost] "; chop($_ = ); if( /^$/ ) { $condor_admin = "$who\@$fullhost"; } else { $condor_admin = $_; } $def_mail_path = &get_default_mail_path(); while(1) { print "\nWhat is the full path to a mail program that understands ", "\"-s\" means\nyou want to specify a subject? [$def_mail_path] "; chop($_ = ); if( /^$/ ) { $mail_path = $def_mail_path; } else { $mail_path = $_; } if( ! (-x $mail_path && -f $mail_path) ) { print "I can't execute \"$mail_path\", try again.\n"; } else { last; } } } sub get_default_mail_path { local( $mail_path ); chop($_ = `uname`); SWITCH: { if(/^Linux/) { $mail_path="/usr/bin/mail"; last SWITCH; } if(/^SunOS/) { $mail_path="/usr/ucb/mail"; last SWITCH; } if(/^HP-UX/) { $mail_path="/bin/mailx"; last SWITCH; } if(/^IRIX.*/) { $mail_path="/usr/sbin/mailx"; last SWITCH; } if(/^OSF1/) { $mail_path="/usr/ucb/mailx"; last SWITCH; } $mail_path="/bin/mail"; } -f $mail_path && -x $mail_path && return $mail_path; foreach $mail_path ( "/bin/mailx", "/usr/sbin/mailx", "/usr/ucb/mailx", "/usr/bin/mail", "/usr/ucb/mail", "/bin/mail" ) { -f $mail_path && -x $mail_path && return $mail_path; } return ""; } sub install_release_dir { local( $release_dir, $def_rel_dir ); $release_dir = &find_release_dir(); if( $release_dir ) { print "\nIt looks like you've installed a Condor release ", "directory in:\n$release_dir\nDo you want to use this ", "release directory? [yes] "; chop( $_ = ); if( /(^[Yy].*)|^$/ ) { return $release_dir; } } else { print "\nI can't find a complete Condor release directory.\n"; } while( 1 ) { print "\nHave you installed a release directory already? [no] "; chop( $_ = ); if( /(^[Nn].*)|^$/ ) { last; } else { print "What's the full path to the release directory? "; chop( $release_dir = ); if( &check_release_dir( $release_dir ) ) { return $release_dir; } else { print "$release_dir doesn't contain a complete release directory,\n", "try again.\n"; } } } # If we're still here, there's no release directory installed already. if( $< ) { $def_rel_dir = "$tilde/condor"; } else { $def_rel_dir = "/usr/local/condor"; } while( 1 ) { print "\nWhere would you like to install the Condor release ", "directory?\n[$def_rel_dir] "; chop( $_ = ); if( /^$/ ) { $release_dir = $def_rel_dir; } else { $release_dir = $_; } if( -d $release_dir ) { last; } else { print "That directory doesn't exist, should I create it now? [yes] "; chop( $_ = ); if( /(^[Yy].*)|^$/ ) { if( ! mkdir( $release_dir, 0777 ) ) { print "Can't create $release_dir: $!.\nTry again.\n"; } else { last; } } else { print "I have to install a release directory, try again.\n"; } } } &install_release_tar( $release_dir ); # Final sanity check... make sure the release.tar we had was complete: if( &check_release_dir( $release_dir ) ) { return $release_dir; } else { print "Error installing the release.tar file, try again.\n"; return &install_release_dir(); } } sub install_release_tar { local( $install_path ) = @_; local( $rel_tar, $dir ); chop($dir = `pwd`); if( ! -f "release.tar" ) { print "\nThere's no \"release.tar\" file in the current directory.\n", "The Condor binary distribution contains a \"release.tar\" file, which\n", "is a tar file archive of the entire Condor release directory.\n"; while( 1 ) { print "What's the full path to the release.tar file?\n"; chop( $_ = ); if( ! /^.*release\.tar$/ ) { $rel_tar = "$_/release.tar"; } else { $rel_tar = $_; } if( -f $rel_tar ) { last; } else { print "\"$rel_tar\" doesn't exist, try again.\n"; } } } else { $rel_tar = "$dir/release.tar"; } print "Installing a release directory into $install_path ... \n"; chdir $install_path || die "\nCan't cd to $install_path: $!\n"; system( "tar -xvf $rel_tar") && die "\nCan't untar $rel_tar\n"; chdir $dir || die "\nCan't cd to $dir: $!\n"; print "done.\n"; } sub find_release_dir { local( $path ); chop($_ = `which condor_config_val`); if( /^\/.*$/ ) { chop($path = `condor_config_val RELEASE_DIR 2> /dev/null`); if( &check_release_dir($path) ) { return $path; } } if( &check_release_dir("/usr/local/condor") ) { return "/usr/local/condor"; } return ""; } sub check_release_dir { local( $dir ) = @_; local( $tmp ); local( @lib_names ); -d $dir || return ""; -d "$dir/lib" || return ""; -d "$dir/bin" || return ""; -d "$dir/sbin" || return ""; -d "$dir/etc" || return ""; -d "$dir/etc/examples" || return ""; -f "$dir/etc/examples/condor.generic" || return ""; -f "$dir/etc/examples/condor_config.generic" || return ""; -f "$dir/etc/examples/condor_config.submit.generic" || return ""; -f "$dir/etc/examples/condor_config.root.generic" || return ""; -f "$dir/etc/examples/condor_config.local.central.manager" || return ""; foreach $tmp( @bin_names ) { -x "$dir/bin/condor_$tmp" || return ""; } foreach $tmp( @sbin_master_names ) { -x "$dir/sbin/condor_$tmp" || return ""; } # See if we've got a "clipped" version of condor_compile, in which # case, we don't need anything in lib. $is_clipped=0; open( FOO, "<$dir/bin/condor_compile" ) || return ""; while( ) { last if $is_clipped; if( /.*clipped.*/ ) { $is_clipped = 1; } } close( FOO ); if( $is_clipped ) { @lib_names=(); } else { @lib_names = @full_lib_names; } foreach $tmp( @lib_names ) { -f "$dir/lib/$tmp" || return ""; } return $dir; } sub prompt_install_path { local( $path, $def_path ); if( $< ) { $def_path = "$tilde/bin"; } else { $def_path = "/usr/local/bin"; } while(1) { print "\nWhere should I install these files?\n", "[$def_path] "; chop( $_ = ); if( /^$/ ) { $path = $def_path; } else { $path = $_; } if( ! grep(/$path/, ($ENV{PATH})) ) { print "$path isn't in your PATH, do you still want to use it? [no] "; chop( $_ = ); if( /(^[Nn].*)|^$/ ) { next; } } if( ! -d $path ) { print "$path is not a directory, should I create it? [yes] "; chop( $_ = ); if( /(^[Yy].*)|^$/ ) { if( ! mkdir($path, 0777) ) { print "I can't create $path: $!.\nTry again.\n"; next; } } else { next; } } elsif( ! -w $path ) { print "You don't have permission to write into $path, ", "try again.\n"; next; } last; } if( ! grep(/$path/, ($ENV{PATH})) ) { print "\nBe sure to add $path to your PATH when this is done\n", "so you can access the files I install.\n"; } return $path; } sub configure_full_install { local( $cm, $local_dir_str, $config_file, $mach, $local_config_str, $has_mach, $is_cm, $name, $path, $lock, $has_config ); # Initialize some variables $local_config_str = ""; $local_dir_str = ""; $has_mach = 0; $is_cm = 0; print "\n***************************************************************************\n", "\tSTEP 6: Java Universe support in Condor.\n", "***************************************************************************\n"; $java_jvm_path = &prompt_java_jvm_path(); print "\nUsing JVM $java_jvm_path for Java universe support.\n" if ($java_jvm_path ne ""); print "\nPress enter to continue. "; $_ = ; print "\n***************************************************************************\n", "\tSTEP 7: Where should public programs be installed?\n", "***************************************************************************\n"; $path = "$release_dir/bin"; print "\n", "The Condor binaries and scripts are already installed in:\n", "\t$path\n"; if( ! grep(/$path/, ($ENV{PATH})) ) { # Not in the PATH print "If you want, I can create some soft links from a directory that is already\n", "in the default PATH to point to these binaries, so that Condor users do not\n", "have to change their PATH. Alternatively, I can leave them where they are\n", "and Condor users will have to add $path\n", "to their PATH or explicitly use a full pathname to access the Condor tools.\n", "\nShall I create links in some other directory? [yes] "; chop( $_ = ); if( /(^[Yy].*)|^$/ ) { $path = &prompt_install_path(); } else { $path = ""; } } else { # Already in the PATH print "This directory is already in your PATH, so there is nothing else you\n", "need to do.\n"; $path = ""; } print "\nPress enter to continue. "; $_ = ; print "\n***************************************************************************\n", "\tSTEP 8: What machine will be your central manager?\n", "***************************************************************************\n"; $cm = &prompt_central_manager( 0 ); if( $cm eq $host || $cm eq $fullhost ) { print "\nYour central manager will be on the local machine.\n"; $is_cm = 1; } print "\nPress enter to continue. "; $_ = ; print "\n***************************************************************************\n", "\tSTEP 9: Where will the \"local directory\" go?\n", "***************************************************************************\n"; if( @machines ) { # Figure out where the local_dir should be. print "\nEach machine in your pool will need a unique directory\n"; if( $condor_home ) { # There's a condor user print "\nYou have a \"condor\" user on this machine. Is the home ", "directory for\nthis account ($condor_home) shared among all ", "machines in your pool?\n[yes] "; $_ = ; if( /(^[Yy].*)|^$/ ) { print "\nDo you want to put all the Condor directories for ", "each machine in\nsubdirectories of $condor_home/hosts? [yes] "; $_ = ; if( /(^[Yy].*)|^$/ ) { $local_dir = "$condor_home/hosts"; -d $local_dir || mkdir( $local_dir, 0777) || die "Can't create $local_dir: $!\n"; print "\nUsing $local_dir/[hostname] as the local ", "directory for each host.\n"; $local_dir_str = "\$(TILDE)/hosts/\$(HOSTNAME)"; $has_mach = 1; $needs_lock=1; } } else { # Condor's home directory is local print "\nDo you want to put all the Condor directories for ", "each machine in\n$condor_home? [yes] "; $_ = ; if( /(^[Yy].*)|^$/ ) { $local_dir = $condor_home; -d $local_dir || mkdir( $local_dir, 0777) || die "Can't create $local_dir: $!\n"; print "\nUsing $local_dir as the local directory for each host.\n", "\nYou will have to run condor_init on the other machines before\n", "you can start up Condor on them.\n"; $local_dir_str = "\$(TILDE)"; } } } if( ! $local_dir_str && -w $release_dir) { # We still haven't found a local dir we want, but # $release_dir is writable to us. print "\nDo you want to put all the Condor directories for ", "each machine in\nsubdirectories of $release_dir? [yes] "; $_ = ; if( /(^[Yy].*)|^$/ ) { $local_dir = "$release_dir/hosts"; -d $local_dir || mkdir( $local_dir, 0777) || die "Can't create $local_dir: $!\n"; print "\nUsing $local_dir/[hostname] as the local ", "directory for each host.\n"; $local_dir_str = "\$(RELEASE_DIR)/hosts/\$(HOSTNAME)"; $has_mach = 1; $needs_lock=1; } } if( ! $local_dir_str ) { # We still haven't found a local dir we want, just ask. print "\nWhere do you want the local directory for each host?\n", "(The directory you specify must be unique for all machines in ", "your\npool. If you include \"\$(HOSTNAME)\", that will get ", "expanded to the\nhostname of each machine you are setting up.)\n"; chop( $_ = ); $local_dir_str = $_; if( $_ =~ s/^(.*)\/\$\(HOSTNAME\)$/$1/ ) { $local_dir = $_; $has_mach = 1; } else { $local_dir = $local_dir_str; $has_mach = 0; } if( ! -d $local_dir ) { mkdir($local_dir, 0777) || die "\nCan't create $local_dir: $!\n\n"; } $needs_lock=1; } } else { # Only setting up one machine print "\nCondor will need to create a few directories for its own use\n"; if( $condor_home ) { print "\nYou have a \"condor\" user on this machine. Do you want to ", "put all the\nCondor directories in $condor_home? [yes] "; $_ = ; if( /(^[Yy].*)|^$/ ) { $local_dir = $condor_home; -d $local_dir || mkdir( $local_dir, 0777) || die "Can't create $local_dir: $!\n"; $local_dir_str = "\$(TILDE)"; } } if( ! $local_dir_str && -w $release_dir) { # We still haven't found a local dir we want, but # $release_dir is writable to us. print "\nDo you want to put all the Condor directories in\n", "$release_dir/home? [yes] "; $_ = ; if( /(^[Yy].*)|^$/ ) { $local_dir = "$release_dir/home"; -d $local_dir || mkdir( $local_dir, 0777) || die "Can't create $local_dir: $!\n"; $local_dir_str = "\$(RELEASE_DIR)/home"; } } if( ! $local_dir_str ) { # We still haven't found a local dir we want, just ask. print "\nWhere do you want the Condor directories?\n"; chop( $_ = ); $local_dir_str = $_; $local_dir = $_; if( ! -d $local_dir ) { mkdir($local_dir, 0777) || die "\nCan't create $local_dir: $!\n\n"; } } } print "\nCreating all necessary Condor directories ... "; if( @machines && $has_mach ) { foreach $mach (@machines) { &condor_init( "$local_dir/$mach", "log", "spool", "execute" ); } } else { &condor_init( $local_dir, "log", "spool", "execute" ); } print "done.\n"; $lock = &find_lock_dir(); print "\nPress enter to continue. "; $_ = ; print "\n***************************************************************************\n", "\tSTEP 10: Where will the local (machine-specific) config files go?\n", "***************************************************************************\n"; if( @machines ) { # If there are multiple machines, force a local config file. $local_config_str = &prompt_local_config_file( $release_dir, $local_dir, $has_mach, 1 ); } else { # If we're on the CM, we want to force a local config file. $local_config_str = &prompt_local_config_file( $release_dir, $local_dir, 0, $is_cm ); } $config_file = "$release_dir/etc/condor_config"; @args=( $config_file, "$release_dir/etc/examples/condor_config.generic", $cm, $local_dir_str, $local_config_str, $lock, "" ); &customize_config_file( @args ); print "\nPress enter to continue. "; $_ = ; if( $is_cm ) { print "\nSetting up $cm as your central manager\n"; $_ = $local_config_str; s/(.*)\$\(HOSTNAME\)(.*)/$1$host$2/; s/(.*)\$\(LOCAL_DIR\)(.*)/$1$local_dir$2/; &configure_central_manager( $_ ); print "\nPress enter to continue. "; $_ = ; } print "\n***************************************************************************\n", "\tSTEP 11: How do you want Condor to find its config file?\n", "***************************************************************************\n"; $has_config=0; print "\nCondor searches a few locations to find it main config file. The first place\n", "is the envionment variable CONDOR_CONFIG. The second place it searches is\n", "/etc/condor/condor_config, and the third place is ~condor/condor_config.\n"; if( $condor_home ) { if( -f "$condor_home/condor_config" ) { print "$condor_home/condor_config exists.\n", "Renaming to: $condor_home/condor_config.old.\n"; rename( "$condor_home/condor_config", "$condor_home/condor_config.old" ); } print "\nShould I put in a soft link from $condor_home/condor_config to\n", "$config_file [yes] "; $_ = ; if( /(^[Yy].*)|^$/ ) { symlink( $config_file, "$condor_home/condor_config" ) || die "Can't create symbolic link: $!\n"; &customize_init_script( "home" ); } } if( ( ! -f "$condor_home/condor_config") && (-w "/etc") ) { print "\nShould I put in a soft link from /etc/condor/condor_config to\n", "$config_file [yes] "; $_ = ; if( /(^[Yy].*)|^$/ ) { (-d "/etc/condor") || mkdir("/etc/condor", 777) || die "Can't create /etc/condor: $!\n"; -f "/etc/condor/condor_config" && rename( "/etc/condor/condor_config", "/etc/condor/condor_config.old" ); symlink( $config_file, "/etc/condor/condor_config" ) || die "Can't create symbolic link: $!\n"; &customize_init_script( "etc" ); } } if( $path ) { print "\nInstalling links for public binaries into $path ... "; foreach $name (@bin_names) { if( -f "$path/condor_$name" ) { rename( "$path/condor_$name", "$path/condor_$name.old" ); } symlink( "$release_dir/bin/condor_$name", "$path/condor_$name" ) || die "Can't create symbolic link $path/condor_$name:\n$!\n"; } print "done.\n"; } # Customize the boot script, just in case they use it. &customize_boot_script(0); # Dump out the @machines list &create_roster_file(); print "\nPress enter to continue. "; $_ = ; # Now that we're done, print out a message explaining what to do next: print "\n", "***************************************************************************\n", "Condor has been fully installed on this machine.\n", "***************************************************************************\n\n", "$release_dir/sbin contains various administrative tools.\n", "If you are going to administer Condor, you should probably place that\n", "directory in your PATH.\n\n"; if( $needs_lock ) { print "Be sure to run condor_init on each machine in your pool to create\n", "the lock directory before you start Condor there.\n\n"; } print "To start Condor on any machine, just execute:\n", "$release_dir/sbin/condor_master\n\n"; if( $is_cm ) { print "Since this is your central manager, you should start Condor here first.\n"; } else { print "You should start Condor on your central manager ($cm) first.\n"; } print "\nPress enter to continue. "; $_ = ; print "\nYou should probably setup your machines to start Condor automatically at\n", "boot time. If your machine uses System-V style init scripts, look in\n", "$release_dir/etc/examples/condor.boot\n", "for a script that you can use to start and stop Condor.\n", "\nPlease read the \"Condor is installed... now what?\" section of the INSTALL\n", "file for things you should do before and after starting the Condor daemons.\n", "In particular, you might want to set up host/ip access security. See the\n", "Adminstrator's Manual for details.\n"; } sub customize_init_script { local( $type ) = $_[0]; local( $init_name ) = "$release_dir/sbin/condor_init"; rename( $init_name, "$init_name.old" ) || die "Can't rename $init_name: $!\n"; open( GENERIC, "<$init_name.old" ); open( INIT, ">$init_name" ); while( ) { if( /^# Create soft link, as needed, to find the global.*/ ) { print INIT $_; if( $type eq "home" ) { print INIT "HOME=`\$CONFIG_VAL_PATH -tilde 2> /dev/null`\n", "if [ ! -n \"\$HOME\" ]; then\n", " echo \"Error: Can't find user condor's home directory.\"\n", " echo \"Either create a 'condor' account on this machine, or re-run\"\n", " echo \"condor_install to configure it not to use a condor home directory.\"\n", " exit 1\n", "fi\n", "if [ ! -f \"\$HOME/condor_config\" ]; then\n", " ln -s $release_dir/etc/condor_config \$HOME/condor_config\n", " if [ ! -f \"\$HOME/condor_config\" ]; then\n", " echo \"Can't create soft link: \$HOME/condor_config\"\n", " echo \"Aborting.\"\n", " exit 1\n", " else\n", " echo \"Created soft link: \$HOME/condor_config\"\n", " fi\n", "else\n", " echo \"\$HOME/condor_config already exists.\"\n", "fi\n"; } elsif( $type eq "etc" ) { print INIT "if [ ! -d \"/etc/condor\" ]; then\n", " mkdir /etc/condor\n", " if [ ! -d \"/etc/condor\" ]; then\n", " echo \"Can't create directory: /etc/condor\"\n", " echo \"Aborting.\"\n", " exit 1\n", " fi\n", "fi\n", "if [ ! -f \"/etc/condor/condor_config\" ]; then\n", " ln -s $release_dir/etc/condor_config /etc/condor/condor_config\n", " if [ ! -f \"/etc/condor/condor_config\" ]; then\n", " echo \"Can't create soft link: /etc/condor/condor_config\"\n", " echo \"Aborting.\"\n", " exit 1\n", " else\n", " echo \"Created /etc/condor/condor_config\"\n", " fi\n", "else\n", " echo \"/etc/condor/condor_config already exists\"\n", "fi\n"; } else { die "Unknown type: $type in customize_init_script\n"; } } elsif( /^CONFIG_VAL_PATH=.*$/ ) { print INIT "CONFIG_VAL_PATH=\"$release_dir/bin/condor_config_val\"\n"; } else { print INIT $_; } } close GENERIC; close INIT; unlink( "$init_name.old" ); chmod( 0755, $init_name ); } sub find_lock_dir { local( $lock, $lockdef ); if( ! $needs_lock ) { return ""; } print "\nCondor needs a few lock files to syncronize access to it's log files.\n", "You're using a shared file system for your local Condor directories.\n", "Because of problems we've had with file locking over network file\n", "systems, we recomend that you specify a directory on a local\n", "partition to put these lock files.\n", "\nDo you want to specify a local partition for file locking? [yes] "; $_ = ; if( /^[Nn].*/ ) { print "\nAlright, but you might run into trouble later...\n"; return ""; } if( -w "/var/lock" ) { $lockdef = "/var/lock/condor"; } elsif( -w "/var/run" ) { $lockdef = "/var/run/condor"; } else { $lockdef = ""; } while( 1 ) { print "\nWhere should I put the lock files? "; $lockdef && print "[$lockdef] "; chop($_ = ); if( /^$/ && $lockdef ) { $lock = $lockdef; } else { $lock = $_; } if( ! -d $lock ) { print "$lock does not exist.\n"; $_ = $lock; $_ =~ s/(.*)\/(.*)?/$1/; if( ! -w $_ ) { print "You don't have permission to create $lock\nTry again.\n"; } else { print "Shall I create it now? [yes] "; $_ = ; if( /(^[Yy].*)|^$/ ) { mkdir( $lock, 0777 ) || die "\nCan't mkdir $lock: $!\n"; last; } } } elsif( ! -w $lock ) { print "You don't have permission to write into $lock, try again.\n"; } else { last; } } chown($owner, -1, $lock) || die "\nCan't chown $lock: $!\n"; print "\nWhen condor_install completes, you will have to run condor_init\n", "on each machine in your pool before you start Condor there. condor_init\n", "will create the local lock directory with the right permissions.\n"; return $lock; } sub configure_central_manager { local( $local_config ) = @_; local( $generic, $name ); $generic = "$release_dir/etc/examples/condor_config.local.central.manager"; if( ! $local_config ) { chop($_ = `$release_dir/bin/condor_config_val LOCAL_CONFIG_FILE 2> /dev/null`); if( ! /^\/.*/ ) { print "\nCan't find the local config file for this host.\n\n", "That probably means you haven't done a full-install of Condor yet.\n", "Please do a full install before you choose \"Central Manager\" in STEP 1.\n", "If you're using a shared filesystem for your Condor binaries, you should\n", "do the full install on your file server. If you want the same machine to\n", "be your central manager, the full-install will take care of that for you\n", "automatically. If you don't have a shared filesystem, you will have to\n", "run condor_install on every machine in your pool, anyway.\n\n"; exit(1); } $local_config = $_; } if( -s $local_config ) { print "\n$local_config already exists.\n", "Moving $local_config to $local_config.old\n"; rename( $local_config, "$local_config.old" ) || die "Can't rename $local_config\n"; } print "\nWhat name would you like to use for this pool? This should be a\n", "short description (20 characters or so) that describes your site.\n", "For example, the name for the UW-Madison Computer Science Condor\n", "Pool is: \"UW-Madison CS\". This value is stored in your central\n", "manager's local config file as \"COLLECTOR_NAME\", if you decide to\n", "change it later. (This shouldn't include any \" marks).\n"; chop($_ = ); if( /^$/ ) { $name = ""; } else { s/"//g; $name = $_; } print "\nSetting up central manager config file $local_config ... "; if( $name ) { open( GENERIC, "<$generic" ) || die "Can't open file $generic: $!\n"; open( LOCAL, ">$local_config" ) || die "Can't open file $local_config: $!\n"; while( ) { if( /^#COLLECTOR_NAME.*/ ) { print LOCAL "COLLECTOR_NAME\t\t= $name\n"; } else { print LOCAL $_; } } close GENERIC; close LOCAL; } else { system( "/bin/cp -f $generic $local_config" ) && die "\nCan't copy default central manager config file to\n$local_config:\n$!\ n"; } print "done.\n"; } sub customize_boot_script { local( $use_script ) = @_; if( $use_script ) { $master = "$path/condor_master"; } else { $master = "$release_dir/sbin/condor_master"; } rename( "$release_dir/etc/examples/condor.boot", "$release_dir/etc/examples/condor.boot.generic" ); open( GENERIC, "<$release_dir/etc/examples/condor.boot.generic" ); open( BOOT, ">$release_dir/etc/examples/condor.boot" ); while( ) { if( /^MASTER.*/ ) { print BOOT "MASTER=$master\n"; } else { print BOOT $_; } } close GENERIC; close BOOT; unlink( "$release_dir/etc/examples/condor.boot.generic" ); chmod( 0755, "$release_dir/etc/examples/condor.boot" ); } sub create_roster_file { @machines || return; local( $mach ); open( ROSTER, ">$release_dir/etc/roster" ); foreach $mach (@machines) { print ROSTER "$mach\n"; } close ROSTER; print "\nCreated $release_dir/etc/roster,\n", "the list of all machines in your pool.\n"; } # Figure out how many pools we want to join and what their nicknames # are. Returns a list of pools. If the list is empty, we're only # adding ourself to one pool. If not, the first element in the list # is the default pool. sub prompt_pools { local( @pools, $pool, $i, $num_pools ); print "\nHow many different pools would you like to add this machine to? [1] "; chop($_ = ); if( /^$/ ) { $num_pools = 1; } else { $num_pools = $_; } if( $num_pools < 1 ) { print "That's an invalid number of pools, try again\n\n"; return &prompt_pools(); } elsif( $num_pools > 1 ) { print "\n", "Since you want to add this machine to multiple pools, you will be asked\n", "to give each one a nickname, used to identify it when you run the\n", "various Condor tools and daemons. One pool will be the default, which\n", "will be used if you don't specify a pool explicitly.\n\n"; print "What's the nickname of the pool you want to use by default?\n"; chop($pool = ); push( @pools, $pool ); for( $i=1; $i<$num_pools; $i++ ) { print "What's the nickname of the next pool you want to use?\n"; chop($pool = ); if( grep(/$pool/, @pools) ) { print "\"$pool\" is already in use as a nickname, try again.\n"; redo; } push( @pools, $pool ); } } return @pools; } # Figure out what to use for UID and FileSystem domain. sub prompt_domain_settings { print "\nTo correctly run all jobs in your pool, including ones that aren't ", "relinked\nfor Condor, you must tell Condor if you have a shared filesystem, ", "and if\nso, what machines share it.\n", "\nPlease read the \"Configuring Condor\" section of the Administrator's manual\n", "(in particular, the section \"Shared Filesystem Config File Entries\")\n", "for a complete explaination of these (and other, related) settings.\n"; print "\nDo all of the machines in your pool from your domain ", "(\"$domain\")\nshare a common filesystem? [no] "; chop($_ = ); if( /^y.*/i ) { print "\nConfiguring all machines to use \"$domain\" for their filesystem", " domain.\n"; $fs_domain=$domain; } else { print "\nConfiguring each machine to be in its own filesystem domain.\n"; $fs_domain="\$(FULL_HOSTNAME)"; } print "\nDo all of the users across all the machines in your domain have a ", "unique\nUID (in other words, do they all share a common passwd file)? [no] "; chop($_ = ); if( /^y.*/i ) { print "\nConfiguring all machines to use \"$domain\" for their uid domain.\n"; $uid_domain=$domain; print "\nIn some cases, even if you have unique UIDs, you might not have ", "all users\nlisted in the password file on each machine.\n", "Is this the case at your site? [no] "; chop($_ = ); if( /^y$/i ) { print "\nSetting \"SOFT_UID_DOMAIN\" to True.\n"; $soft_uid = "True"; } } else { print "\nConfiguring each machine to be in its own uid domain.\n"; $uid_domain="\$(FULL_HOSTNAME)"; } } # Ask the user what their fully qualified hostname is. sub prompt_fullhost { local $fh; print "\nWARNING: I cannot determine a fully-qualified name for this machine.\n"; while( 1 ) { print "\nPlease enter the full hostname, including your domain:\n"; chop($fh = ); print "\nYou entered: $fh\n"; if( $fh =~ /.?\..?/ ) { print "Is that right? [no] "; chop($_ = ); if( /((^y$)|(^yes$))/i ) { return $fh; } } else { print "That doesn't contain any \".\" characters, so it can't be ", "fully-qualified.\nPlease try again.\n"; } } } # Search for default locations for java, and then test to see if it is a # Sun JVM for the maxheap size argument Java needs in the config files. # Do a bunch of stuff to make it interactive friendly too. sub prompt_java_jvm_path() { my $jvm = ""; my @default_jvm_locations = ("/bin/java", "/usr/bin/java", "/usr/local/bin/java", "/s/std/bin/java"); my $java_libdir = "$release_dir/lib"; my $exec_result; my $default_jvm_location; # Ask if they even want support for java print "\nEnable Java Universe support? [yes] "; chomp($_ = ); if( ! /(^[Yy].*)|^$/ ) { print "OK, Java Universe will be left unconfigured.\n"; return ""; } # check some default locations for java and pick first valid one foreach $default_jvm_location (@default_jvm_locations) { if ( -f $default_jvm_location && -x $default_jvm_location) { $jvm = $default_jvm_location; last; } } # if nothing is found, explain that, otherwise see if they just want to # accept what I found. if ($jvm eq "") { print "\nI wasn't able to find a valid JVM.\n"; } else { print "\nI have found a JVM: $jvm.\n\nIs this acceptable? [yes] "; chop( $_ = ); if( /(^[Yy].*)|^$/ ) { goto JAVA_MEM_CHECK; # sorry.... } } # If they didn't accept my choice for one reason or another then force # a fully qualified java executable path from them. while( 1 ) { print "\nPlease enter the full path to the JVM, or \"none\" to leave unconfigured:\n"; chomp($jvm = ); if ($jvm eq "none" || $jvm eq "\"none\"") { print "OK, Java Universe will be left unconfigured.\n"; return ""; } print "\nYou entered: $jvm\n"; if( $jvm =~ /^\//) { if ( -f $jvm && -x $jvm) { print "Is that right? [no] "; chop($_ = ); if( /((^y$)|(^yes$))/i ) { last; # break out of while loop } } else { print "That executable seems to not be present or executable!\n", "Please try again.\n"; } } else { print "That path doesn't start with an '/'.\n", "Please try again.\n"; } } # Now that we have an executable JVM, see if it is a Sun jvm because that # JVM it supports the -Xmx argument then, which is used to specify the # maximum size to which the heap can grow. JAVA_MEM_CHECK: print "\nChecking to see if you have a Sun JVM..."; # execute a program in the condor lib directory that just got installed. # We are going to pass an -Xmx flag to it and see if we have a Sun JVM, # if so, mark that fact for the config file. $tmp = $ENV{"CLASSPATH"}; $ENV{"CLASSPATH"} = $java_libdir; $exec_result = 0xffff & system("$jvm -Xmx1024m CondorJavaInfo new 0 > /dev/null 2>&1"); $ENV{"CLASSPATH"} = $tmp; if ($exec_result == 0) { print "yes.\n"; $java_jvm_maxmem_arg = "-Xmx"; # Sun JVM max heapsize flag } else { print "no.\n"; $java_jvm_maxmem_arg = ""; } return $jvm; }