#!/usr/bin/perl use Getopt::Long; use Cwd; use Config; my ($dir, $perl, $probe, $ignore, $help, $version, $man, $archivetar, $strict); $list++ if ! @ARGV; my $options_result = GetOptions( 'location=s' => \$dir, 'help|?' => \$help, 'man' => \$man, 'version' => \$version, 'perl=s' => \$perl, 'gtar=s' => \$mode{'gtar'}, 'gzip=s' => \$mode{'gzip'}, 'gunzip=s' => \$mode{'gunzip'}, 'gmake=s' => \$mode{'gmake'}, 'rpm=s' => \$mode{'rpm'}, 'rpmbuild=s' => \$mode{'rpmbuild'}, 'license=s' => \$mode{'license'}, 'vendor=s' => \$mode{'vendor'}, 'ftpsite=s' => \$mode{'ftpsite'}, 'url=s' => \$mode{'url'}, 'packager=s' => \$mode{'packager'}, 'prefix=s' => \$mode{'prefix'}, 'force=s' => \$mode{'force'}, 'list' => \$list, 'use-archive-tar' => \$archivetar, 'probe' => \$probe, 'ignore-errors' => \$ignore, 'strict' => \$strict ); # # read in the main GPT environment variables # my $gpath = $dir; if (!defined($gpath)) { $gpath = $ENV{GPT_LOCATION}; } if (!defined($gpath)) { $gpath = $ENV{GLOBUS_LOCATION}; } if (!defined($gpath)) { die "GPT_LOCATION or GLOBUS_LOCATION needs to be set before running this script"; } # # alter the include path # @INC = ("$gpath/lib/perl", "$gpath/lib/perl/$Config{'archname'}", @INC); if ( ! ( defined eval "require Grid::GPT::GPTObject" ) ) { die("$gpath does not appear to hold a valid GPT installation\n"); } require Pod::Usage; Pod::Usage::pod2usage(2) if ! $options_result; Pod::Usage::pod2usage(0) if defined $help; Pod::Usage::pod2usage(-verbose => 2) if defined $man; require Grid::GPT::GPTIdentity; if (defined $version) { Grid::GPT::GPTIdentity::print_gpt_version(); exit 0; } # Add path to LocalEnv module to @INC push @INC,"/var/db/gpt"; if (defined $list) { die "ERROR: GPT has not been configured\n" if ! defined eval "require Grid::GPT::LocalEnv;"; require Grid::GPT::LocalEnv; Grid::GPT::LocalEnv::listconfig(); exit 0; } require Grid::GPT::Localize; if ( defined eval "require Grid::GPT::LocalEnv;" and ! defined $probe) { require Grid::GPT::LocalEnv; for $m (Grid::GPT::Localize::get_rpm_settings_list()) { $mode{$m} = Grid::GPT::LocalEnv::get_rpm_setting($m) if ! defined $mode{$m}; } for $m (Grid::GPT::Localize::get_tool_list()) { $mode{$m} = Grid::GPT::LocalEnv::get_tool_location($m) if ! defined $mode{$m}; } } my $localizer = new Grid::GPT::Localize(%mode, ignore_errors => $ignore, gpath => $gpath, systar => defined $archivetar ? undef : 1, ); if (defined $perl or defined $probe) { $perl = $localizer->set_perl( location => $perl, version => '5.005'); die "ERROR: No compatible Perl executable found\n" if ! defined $perl; modify_gpt_scripts(); } $localizer->probe_for_tools() if defined $probe; $localizer->set_tools(); if ($localizer->getsub('rpm') eq 'Not Available') { $localizer->clear_rpm_settings(); } else { $localizer->set_rpm_settings(); } for $m (Grid::GPT::Localize::get_rpm_settings_list()) { $localizer->setsub($m, $mode{$m}) if defined $mode{$m}; } $localizer->check_for_usr_sbin_check(); $localizer->localize(); sub modify_gpt_scripts { open LIST, "$gpath/etc/gpt/gpt_scripts_list"; my $list = ; my @scripts = split /\s+/, $list; for $s (@scripts) { next if $s !~ m!\w+!; open SCRIPT, "$gpath/sbin/$s"; my @contents =